Skip to content

Commit

Permalink
chore: update flake.lock
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Nov 8, 2024
1 parent 7768f62 commit d3c4f68
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 43 deletions.
50 changes: 25 additions & 25 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 35 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -147,6 +163,7 @@
'')
];
};
});
}
);
};
}

0 comments on commit d3c4f68

Please sign in to comment.