diff options
-rw-r--r-- | flake.nix | 2 | ||||
-rw-r--r-- | justfile | 36 | ||||
-rw-r--r-- | nix/lib/mkSystem.nix | 2 | ||||
-rw-r--r-- | nix/machines/hq-c02fk3q7md6t/default.nix (renamed from nix/machines/macbook-pro-intel.nix) | 2 | ||||
-rw-r--r-- | nix/machines/mba-m2/default.nix (renamed from nix/machines/macbook-air-m2.nix) | 4 | ||||
-rw-r--r-- | nix/machines/vm-aarch64.nix | 4 | ||||
-rw-r--r-- | nix/machines/vm-aarch64/default.nix | 5 | ||||
-rw-r--r-- | nix/machines/vm-aarch64/hardware.nix (renamed from nix/machines/hardware/vm-aarch64-utm.nix) | 0 | ||||
-rw-r--r-- | nix/machines/vm-hetzner/default.nix (renamed from nix/machines/vm-hetzner.nix) | 0 | ||||
-rw-r--r-- | nix/machines/vm-hetzner/hardware.nix (renamed from nix/machines/hardware/vm-hetzner.nix) | 0 | ||||
-rw-r--r-- | nix/machines/vm-synology.nix | 4 | ||||
-rw-r--r-- | nix/machines/vm-synology/default.nix | 5 | ||||
-rw-r--r-- | nix/machines/vm-synology/hardware.nix (renamed from nix/machines/hardware/vm-synology.nix) | 0 |
13 files changed, 38 insertions, 26 deletions
diff --git a/flake.nix b/flake.nix index 178bc25..15cbde8 100644 --- a/flake.nix +++ b/flake.nix @@ -92,7 +92,7 @@ }; # my personal MacBook Air - darwinConfigurations.macbook-air-m2 = mkSystem "macbook-air-m2" { + darwinConfigurations.mba-m2 = mkSystem "mba-m2" { system = "aarch64-darwin"; user = "fcuny"; darwin = true; diff --git a/justfile b/justfile index 94877a0..992a107 100644 --- a/justfile +++ b/justfile @@ -3,18 +3,13 @@ SSH_OPTIONS := "-o PubkeyAuthentication=no -o UserKnownHostsFile=/dev/null -o St nixdisk := "vda" nixaddr := "" +hostname := lowercase(`hostname -s`) + # update dependencies +[group('nix')] update-deps: nix flake update --commit-lock-file -# build (and only build) the configuration for darwin -build-darwin: - darwin-rebuild build --flake .#$(hostname -s) - -# build and switch the configuration for darwin -switch-darwin: - darwin-rebuild switch --flake .#$(hostname -s) - # a simple check to ensure the nix configuration is OK test-nix: nix flake check @@ -24,11 +19,25 @@ test-nix: fmt: nix fmt -build-wildcat: - nixos-rebuild build --target-host fcuny.net --build-host fcuny.net --fast --use-remote-sudo --use-substitutes --flake .#wildcat +[group('machines')] +[macos] +build: + darwin-rebuild build --flake .#{{hostname}} + +[group('machines')] +[macos] +switch: + darwin-rebuild switch --flake .#{{hostname}} + +[group('machines')] +[linux] +build: + nixos-rebuild build --flake .#{{hostname}} -switch-wildcat: - nixos-rebuild switch --target-host fcuny.net --build-host fcuny.net --fast --use-remote-sudo --use-substitutes --flake .#wildcat +[group('machines')] +[linux] +switch: + nixos-rebuild switch --flake .#{{hostname}} vm-bootstrap: #!/usr/bin/env bash @@ -61,5 +70,6 @@ vm-copy: rsync -av -e 'ssh {{SSH_OPTIONS}}' \ --exclude='.git/' \ --exclude='result' \ + --exclude='.direnv/' \ --rsync-path="sudo rsync" \ - $(dirname justfile)/ root@{{nixaddr}}:/nix-config + $(dirname justfile)/ {{nixaddr}}:/nix-config diff --git a/nix/lib/mkSystem.nix b/nix/lib/mkSystem.nix index dbacac6..87af732 100644 --- a/nix/lib/mkSystem.nix +++ b/nix/lib/mkSystem.nix @@ -7,7 +7,7 @@ name: let # The config files for this system. - machineConfig = ../machines/${name}.nix; + machineConfig = ../machines/${name}; userOSConfig = ../users/${user}/${if darwin then "darwin" else "nixos"}.nix; userHMConfig = ../users/${user}/home-manager.nix; diff --git a/nix/machines/macbook-pro-intel.nix b/nix/machines/hq-c02fk3q7md6t/default.nix index 07b464e..001f3d5 100644 --- a/nix/machines/macbook-pro-intel.nix +++ b/nix/machines/hq-c02fk3q7md6t/default.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { - imports = [ ./darwin-shared.nix ]; + imports = [ ../darwin-shared.nix ]; system.stateVersion = 5; diff --git a/nix/machines/macbook-air-m2.nix b/nix/machines/mba-m2/default.nix index 9b0265a..72a4e8b 100644 --- a/nix/machines/macbook-air-m2.nix +++ b/nix/machines/mba-m2/default.nix @@ -1,9 +1,9 @@ { pkgs, ... }: { - imports = [ ./darwin-shared.nix ]; + imports = [ ../darwin-shared.nix ]; system.stateVersion = 5; - networking.hostName = "mba-fcuny"; + networking.hostName = "mba-m2"; programs.fish.enable = true; environment.shells = [ pkgs.fish ]; diff --git a/nix/machines/vm-aarch64.nix b/nix/machines/vm-aarch64.nix deleted file mode 100644 index ac9c74e..0000000 --- a/nix/machines/vm-aarch64.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ ... }: { - imports = [ ./hardware/vm-aarch64-utm.nix ./vm-shared.nix ]; - networking.hostName = "vm-aarch64"; -} diff --git a/nix/machines/vm-aarch64/default.nix b/nix/machines/vm-aarch64/default.nix new file mode 100644 index 0000000..302a80c --- /dev/null +++ b/nix/machines/vm-aarch64/default.nix @@ -0,0 +1,5 @@ +{ ... }: { + imports = [ ./hardware.nix ../vm-shared.nix ]; + + networking.hostName = "vm-aarch64"; +} diff --git a/nix/machines/hardware/vm-aarch64-utm.nix b/nix/machines/vm-aarch64/hardware.nix index 084cc74..084cc74 100644 --- a/nix/machines/hardware/vm-aarch64-utm.nix +++ b/nix/machines/vm-aarch64/hardware.nix diff --git a/nix/machines/vm-hetzner.nix b/nix/machines/vm-hetzner/default.nix index a268779..a268779 100644 --- a/nix/machines/vm-hetzner.nix +++ b/nix/machines/vm-hetzner/default.nix diff --git a/nix/machines/hardware/vm-hetzner.nix b/nix/machines/vm-hetzner/hardware.nix index 89a92a9..89a92a9 100644 --- a/nix/machines/hardware/vm-hetzner.nix +++ b/nix/machines/vm-hetzner/hardware.nix diff --git a/nix/machines/vm-synology.nix b/nix/machines/vm-synology.nix deleted file mode 100644 index 643c821..0000000 --- a/nix/machines/vm-synology.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ ... }: { - imports = [ ./hardware/vm-synology.nix ./vm-shared.nix ]; - networking.hostName = "vm-synology"; -} diff --git a/nix/machines/vm-synology/default.nix b/nix/machines/vm-synology/default.nix new file mode 100644 index 0000000..928ab86 --- /dev/null +++ b/nix/machines/vm-synology/default.nix @@ -0,0 +1,5 @@ +{ ... }: { + imports = [ ./hardware.nix ../vm-shared.nix ]; + + networking.hostName = "vm-synology"; +} diff --git a/nix/machines/hardware/vm-synology.nix b/nix/machines/vm-synology/hardware.nix index 5511e98..5511e98 100644 --- a/nix/machines/hardware/vm-synology.nix +++ b/nix/machines/vm-synology/hardware.nix |