Giter VIP home page Giter VIP logo

nixos-config's Introduction

AGPL project chat Harmeless Code of Conduct

This repository contains the Nix / NixOS configuration for all of my systems. See nixos-flake if you want to create your own configuration from scratch.

Setup

To use this repository as base configuration for your new machine running:

NixOS Linux

Tip

For a general tutorial, see https://nixos.asia/en/nixos-install-flake

  • Install NixOS
  • Clone this repo anywhere
  • Edit flake.nix to use your system hostname as a key of the nixosConfigurations set
  • Edit users/config.nix to contain your users
  • Run nix run. That's it. Re-open your terminal.

macOS

  • Install Nix
  • Clone this repo anywhere
  • Edit flake.nix to use your system hostname as a key of the darwinConfigurations set
  • Edit users/config.nix to contain your users
  • Run nix run.1 That's it. Re-open your terminal.

Architecture

Start from flake.nix (see Flakes). flake-parts is used as the module system.

Directory layout

  • home: home-manager config (shared between Linux and macOS)
  • nixos: nixos modules for Linux
  • nix-darwin: nix-darwin modules for macOS
  • users: user information
  • systems: top-level configuration.nix('ish) for various systems

Tips

  • To update NixOS (and other inputs) run nix flake update
    • You may also update a subset of inputs, e.g.
      nix flake lock --update-input nixpkgs --update-input darwin --update-input home-manager
      # Or, `nix run .#update`
  • To free up disk space,
    sudo nix-env -p /nix/var/nix/profiles/system --delete-generations +2
    sudo nixos-rebuild boot
  • To autoformat the project tree using nixpkgs-fmt, run nix fmt.
  • To build all flake outputs (locally or in CI), run nix --accept-flake-config run github:juspay/omnix ci build
  • For secrets management, I use ragenix.

Discussion

If you wish to discuss about this config, join the Zulip.

Footnotes

  1. You might have to rm -rf /etc/nix/nix.conf, so our flake.nix can do its thing. โ†ฉ

nixos-config's People

Contributors

lovingmelody avatar srid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nixos-config's Issues

Nixify `.ssh/config` using home-manager

Host actual
  HostName 167.205.125.179
  ForwardAgent yes

Host biryani
  User admin
  HostName 100.97.32.60
  ForwardAgent yes

# To clone Juspay repos.
# https://developer.1password.com/docs/ssh/agent/advanced/#match-key-with-host
Host bitbucket.org
  IdentityFile ~/.ssh/juspay.pub
  IdentitiesOnly yes

Host *
  IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"

Reintroduce temp VMs

          # For downloading stuff off internet in VPN.
          #
          # This is run in qemu only, which is useful to keep the host machine
          # directly connected to the network (for acccess from outside).
          #
          # > nixos-shell --flake github:srid/nixos-config#corsair
          corsair = pkgs.lib.makeOverridable nixpkgs.lib.nixosSystem {
            inherit system pkgs;
            specialArgs = { inherit system inputs; };
            modules = [
              inputs.nixos-shell.nixosModules.nixos-shell
              {
                virtualisation = {
                  memorySize = 8 * 1024;
                  cores = 2;
                  diskSize = 20 * 1024;
                };
                environment.systemPackages = with pkgs; [
                  protonvpn-cli
                  aria2
                ];
                nixos-shell.mounts = {
                  mountHome = false;
                  mountNixProfile = false;
                  extraMounts."/Downloads" = {
                    target = "/home/${userName}/Downloads";
                    cache = "none";
                  };
                };
              }
            ];
          };
        };

Question regarding home-manager.

In the main flake.nix, is it possible to extract the below snippet into another file and use the file here ?

home-manager.nixosModules.home-manager
{
    home-manager.useGlobalPkgs = true;
    home-manager.useUserPackages = true;
    home-manager.users.srid = import ./home.nix
      {
        inherit inputs system pkgs;
      };
}

Simplify darwin build command

This doesn't look great

TERM=xterm $$(nix build --extra-experimental-features "flakes nix-command" .#darwinConfigurations.$(HOSTNAME).system --no-link --json | nix --extra-experimental-features "flakes nix-command" run ${WITHEXP} nixpkgs#jq -- -r '.[].outputs.out')/sw/bin/darwin-rebuild switch --flake .

Segfault upon updating `flake-parts`

git clone https://github.com/srid/nixos-config.git
nix flake lock --update-input flake-parts
nix develop
trace: warning: When invoking flake-parts, it is recommended to pass all the flake output
arguments in the `inputs` parameter. If you only pass `self`, it's not
possible to use the `inputs` module argument in the module `imports`.

Please pass the output function arguments. For example:

    outputs = inputs@{ flake-parts, ... }:
      flake-parts.lib.mkFlake { inherit inputs; } { /* module */ };

To avoid an infinite recursion, *DO NOT* pass `self.inputs` and
*DO NOT* pass `inherit (self) inputs`, but pass the output function
arguments as `inputs` like above.

~~I tried updating it to use that form and managed to get a segmentation fault ๐Ÿ˜ž ~~

So doing the above steps will show that error on both x86_64 linux and darwin-arch64, but on darwin-arch64 it will segfault. I'm assuming because of infinte recursion it warns about? Not sure.

I'm trying to see if I can downgrade to the older seemingly working flake-parts for now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.