Skip to content

Commit

Permalink
Declare and check versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesplain committed Jun 11, 2024
1 parent fafcdb4 commit 61e18e2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/nix-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
sed -i '' "s/defaultHostname/$(scutil --get LocalHostName)/g" nixos-config/flake.nix
sed -i '' "s/mike.splain/runner/g" nixos-config/flake.nix
sed -i '' "s/defaultSystem/${{matrix.os.arch}}/g" nixos-config/flake.nix
sed -i '' "s/defaultVersion/$(sw_vers --productVersion | cut -d. -f1)/g" nixos-config/flake.nix
sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.before-nix-darwin
sudo mv /etc/shells /etc/shells.before-nix-darwin
Expand Down
6 changes: 4 additions & 2 deletions nixos-config/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
extraSpecialArgs = { inherit inputs user pwnvim; };
users.${user.name} = { imports = [ ./home ]; };
};
system = { system, hostName }: let
system = { system, hostName, osVersion }: let
inherit (nixpkgs.lib.strings) hasInfix;
platform = {
isDarwin = hasInfix "darwin" system;
Expand All @@ -120,7 +120,7 @@
# home-manager = configuration.homeManager;
# }
];
specialArgs = { inherit inputs hostName platform system user; };
specialArgs = { inherit inputs hostName osVersion platform system user; };
in if platform.isDarwin
then nix-darwin.lib.darwinSystem {
inherit system modules specialArgs;
Expand Down Expand Up @@ -172,11 +172,13 @@
SNS005454 = configuration.system {
system = "aarch64-darwin";
hostName = "SNS005454";
osVersion = "14";
# username = "mike.splain";
};
defaultHostname = configuration.system {
system = "defaultSystem";
hostName = "defaultHostname";
osVersion = "defaultVersion";
# username = "mike.splain";
};

Expand Down
9 changes: 6 additions & 3 deletions nixos-config/platforms/darwin/homebrew/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ inputs, lib, user, hostName, ...}:
{ inputs, lib, user, hostName, osVersion, ...}:
let
inherit (inputs)
homebrew-cask
Expand All @@ -18,10 +18,13 @@ in
# "Sonos-Inc/pdsw-engx-devops-sk8s/sk8s"
"ncdu"
];
casks = [
casks = (if osVersion >= "14" then
[
"jordanbaird-ice"
] else []) ++
[
"session-manager-plugin"
"appcleaner"
"jordanbaird-ice"
];

# casks = [];
Expand Down

0 comments on commit 61e18e2

Please sign in to comment.