diff --git a/Makefile b/Makefile index 5dc3800..60d12c1 100644 --- a/Makefile +++ b/Makefile @@ -11,15 +11,6 @@ macos: sudo ls # cache sudo $$(nix build --extra-experimental-features "flakes nix-command" .#darwinConfigurations.air.system --no-link --json | jq -r '.[].outputs.out')/sw/bin/darwin-rebuild switch --flake . -# Not sure why this doesn't reliably work -h0: - nix build ".#homeConfigurations."`hostname`".activationPackage" - ./result/activate - -# This requires the symlink to be setup; see README -h: - PATH="${HOME}/.nix-profile/bin/:${PATH}" home-manager switch - freeupboot: # Delete all but the last few generations sudo nix-env -p /nix/var/nix/profiles/system --delete-generations +2 diff --git a/README.md b/README.md index 44a001a..d7175f6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ This repository contains the Nix / NixOS configuration for all of my systems. Start from `flakes.nix` (see [Flakes](https://nixos.wiki/wiki/Flakes)). -- `home.nix`: Only install things that are needed in all platforms (VMs, VPS, WSL2, etc.) - `flake.nix`: Install things I need natively on NixOS desktop & laptop computers +- `hosts/darwin.nix`: For macOS VSCode note: Ctrl+Shift+B will run effectuate the new configuration (by running `make`). @@ -10,31 +10,19 @@ VSCode note: Ctrl+Shift+B will run effectuate the new configuration ( ### NixOS -``` +```sh-session make nixos ``` ### macOS -``` +```sh-session make darwin ``` -### Other Linux distro (home-manager) - -TODO: This section needs an update. - -First time run, - -``` -make h0 -ln -s /path/to/here ~/.config/nixpkgs # Why? See Makefile -``` - -Afterwards, feel free to use `home-manager switch` (or `make`). - ## Install notes - Hetzner dedicated from Linux Rescue system: https://github.com/serokell/nixos-install-scripts/pull/1#pullrequestreview-746593205 - Digital Ocean: https://github.com/elitak/nixos-infect - X1 Carbon: https://www.srid.ca/x1c7-install +- macOS: https://github.com/LnL7/nix-darwin \ No newline at end of file diff --git a/flake.nix b/flake.nix index 143ac91..0c4758b 100644 --- a/flake.nix +++ b/flake.nix @@ -31,9 +31,7 @@ pkgs = import nixpkgs { inherit system; config.allowUnfree = true; - overlays = [ - (import inputs.emacs-overlay) - ]; + overlays = [ (import inputs.emacs-overlay) ]; }; # Configuration common to all of my systems (servers, desktops, laptops) commonFeatures = [ @@ -41,7 +39,6 @@ ./features/takemessh ./features/caches ./features/current-location.nix - #./features/passwordstore.nix ]; homeFeatures = [ home-manager.nixosModules.home-manager @@ -54,35 +51,27 @@ }; } ]; - mkComputer = extraModules: nixpkgs.lib.nixosSystem { + mkLinuxSystem = extraModules: nixpkgs.lib.nixosSystem { inherit system pkgs; # Arguments to pass to all modules. specialArgs = { inherit system inputs; }; modules = commonFeatures ++ homeFeatures ++ extraModules; }; + mkMacosSystem = darwin.lib.darwinSystem; in { - # The "name" in nixosConfigurations.${name} should match the `hostname` - # nixosConfigurations = { - thick = mkComputer - [ - ./hosts/thick.nix - inputs.nixos-hardware.nixosModules.lenovo-thinkpad-p53 - ]; - thin = mkComputer - [ - ./hosts/thin.nix - inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-7th-gen - ]; - now = mkComputer + # My beefy development computer + now = mkLinuxSystem [ ./hosts/hetzner/ax101.nix ./features/server/harden.nix ./features/server/devserver.nix ./features/hercules.nix ]; + # This is run in qemu only. + # > nixos-shell --flake github:srid/nixos-config#corsair corsair = pkgs.lib.makeOverridable nixpkgs.lib.nixosSystem { inherit system pkgs; specialArgs = { inherit system inputs; }; @@ -113,7 +102,7 @@ }; }; - darwinConfigurations."air" = darwin.lib.darwinSystem { + darwinConfigurations."air" = mkMacosSystem { system = "aarch64-darwin"; specialArgs = { inherit inputs; @@ -123,44 +112,8 @@ modules = [ ./hosts/darwin.nix ./features/nix-direnv.nix - /* - home-manager.nixosModules.home-manager - { - home-manager.users.srid = pkgs.lib.mkMerge [ - inputs.nix-doom-emacs.hmModule - ({ pkgs, ... }: { - programs.doom-emacs = { - enable = true; - doomPrivateDir = ./config/doom.d; - }; - }) - ]; - }*/ ]; }; - - # non-NixOS systems - homeConfigurations = - let - username = "srid"; - baseConfiguration = { - programs.home-manager.enable = true; - home.username = "srid"; - home.homeDirectory = "/home/srid"; - }; - mkHomeConfig = cfg: home-manager.lib.homeManagerConfiguration { - inherit username system; - homeDirectory = "/home/${username}"; - configuration = baseConfiguration // cfg; - }; - in - { - # FIXME: This is broken on Clear Linux - "x1c7" = mkHomeConfig { - programs.git = import ./home/git.nix; - programs.tmux = import ./home/tmux.nix; - }; - }; }; }