-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7768f62
commit d3c4f68
Showing
2 changed files
with
60 additions
and
43 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,27 +58,40 @@ | |
# declare the cache useless. If you do, you will have | ||
# to compile LLVM, Zig and Ghostty itself on your machine, | ||
# which will take a very very long time. | ||
ghostty = { url = "git+ssh://[email protected]/mitchellh/ghostty"; }; | ||
ghostty = { | ||
url = "git+ssh://[email protected]/mitchellh/ghostty"; | ||
}; | ||
}; | ||
|
||
outputs = inputs@{ self, nixpkgs, home-manager, darwin, nur, ... }: | ||
outputs = | ||
inputs@{ | ||
self, | ||
nixpkgs, | ||
home-manager, | ||
darwin, | ||
nur, | ||
... | ||
}: | ||
let | ||
overlays = [ nur.overlay ]; | ||
|
||
mkSystem = import ./lib/mksystem.nix { inherit nixpkgs overlays inputs; }; | ||
|
||
# Generate a list of systems based on their hostname | ||
mkSystems = list: | ||
builtins.listToAttrs (map (x: { | ||
name = x.hostname; | ||
value = mkSystem x; | ||
}) list); | ||
mkSystems = | ||
list: | ||
builtins.listToAttrs ( | ||
map (x: { | ||
name = x.hostname; | ||
value = mkSystem x; | ||
}) list | ||
); | ||
|
||
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix; | ||
nixpkgsFor = | ||
forAllSystems (system: import nixpkgs { inherit system overlays; }); | ||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system overlays; }); | ||
|
||
in { | ||
in | ||
{ | ||
nixosConfigurations = mkSystems [ | ||
{ | ||
hostname = "media"; | ||
|
@@ -108,9 +121,12 @@ | |
} | ||
]; | ||
|
||
devShells = forAllSystems (system: | ||
let pkgs = nixpkgsFor.${system}; | ||
in { | ||
devShells = forAllSystems ( | ||
system: | ||
let | ||
pkgs = nixpkgsFor.${system}; | ||
in | ||
{ | ||
default = pkgs.mkShellNoCC { | ||
shellHook = '' | ||
# Use GitHub access tokens to avoid rate limiting | ||
|
@@ -123,21 +139,21 @@ | |
'') | ||
(writeScriptBin "dot-update" '' | ||
nix flake update | ||
dot-apply | ||
dot-apply "$@" | ||
'') | ||
(writeScriptBin "dot-sync" '' | ||
dot-update | ||
nix-collect-garbage -d | ||
dot-apply | ||
dot-apply "$@" | ||
'') | ||
(writeScriptBin "dot-apply" '' | ||
case "$(uname -s)" in | ||
Linux) | ||
sudo nixos-rebuild switch --flake .#$HOST | ||
sudo nixos-rebuild switch --flake .#$HOST "$@" | ||
;; | ||
Darwin) | ||
HOST=$(hostname | cut -f1 -d'.') | ||
nix run nix-darwin -- switch --flake .#$HOST | ||
nix run nix-darwin -- switch --flake .#$HOST "$@" | ||
;; | ||
*) | ||
echo "Unsupported OS" | ||
|
@@ -147,6 +163,7 @@ | |
'') | ||
]; | ||
}; | ||
}); | ||
} | ||
); | ||
}; | ||
} |