Skip to content

Commit

Permalink
refactor: force having a hardware config, clean pkgs decl in flake
Browse files Browse the repository at this point in the history
  • Loading branch information
mrnossiom committed Jan 4, 2024
1 parent 923e5ac commit 46b5445
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
17 changes: 10 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,27 @@
inherit (nixpkgs.lib) nixosSystem genAttrs;
inherit (home-manager) homeManagerConfiguration;

flake-lib = import ./lib/flake (nixpkgs // { inherit self; });
forAllSystems = genAttrs [ "aarch64-linux" "i686-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];
flake-lib = import ./lib/flake (nixpkgs // { inherit self; });

pkgs = forAllSystems (system: (import nixpkgs {
inherit system;
config.allowUnfreePredicate = import ./lib/unfree.nix;
overlays = [ outputs.overlays.all ];
}) // { inherit self; });
in
{
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
formatter = forAllSystems (system: pkgs.${system}.nixpkgs-fmt);

packages = forAllSystems (system: import ./pkgs (import nixpkgs { inherit system; config.allowUnfreePredicate = import ../lib/unfree nixpkgs.legacyPackages.${system}; }));
apps = forAllSystems (system: import ./apps (nixpkgs.legacyPackages.${system} // { inherit self; }));
packages = forAllSystems (system: import ./pkgs pkgs.${system});
apps = forAllSystems (system: import ./apps pkgs.${system});

overlays = import ./overlays (nixpkgs // { inherit self; });
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;

nixosConfigurations = {
"neo-wiro-laptop" = flake-lib.createSystem [
./nixos/hardware/neo-wiro-laptop.nix
(flake-lib.system "neo-wiro-laptop" ./nixos/profiles/laptop.nix)
(flake-lib.managedDiskLayout "nvme0n1" ./nixos/layout/luks-btrfs.nix)
(flake-lib.user "milomoisson" {
Expand All @@ -63,7 +68,6 @@
];

"archaic-wiro-laptop" = flake-lib.createSystem [
./nixos/hardware/archaic-wiro-laptop.nix
(flake-lib.system "archaic-wiro-laptop" ./nixos/profiles/laptop.nix)
(flake-lib.user "milomoisson" {
description = "Milo Moisson";
Expand All @@ -76,7 +80,6 @@
# Else, configuration is loaded by the HM NixOS module which create system generations and free rollbacks.
homeConfigurations = {
milomoisson = homeManagerConfiguration {
# Home-manager requires 'pkgs' instance
pkgs = nixpkgs.pkgs;
extraSpecialArgs = { inherit self; };
modules = [ ./home-manager/profiles/desktop.nix ];
Expand Down
1 change: 0 additions & 1 deletion home-manager/modules/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ with lib;
diff = "delta";

# Nix-related
# TODO: maybe move to a shell alias?
ns = "nix shell";
ur = " unlink result";

Expand Down
2 changes: 1 addition & 1 deletion home-manager/profiles/desktop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ in
config = {
nixpkgs = {
overlays = [ overlays.all ];
config.allowUnfreePredicate = import ../../lib/unfree.nix pkgs;
config.allowUnfreePredicate = import ../../lib/unfree.nix;
};

programs.home-manager.enable = osConfig == null;
Expand Down
2 changes: 1 addition & 1 deletion lib/flake/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ with lib;
};

system = hostName: profile: {
imports = [ profile ];
imports = [ profile ../../nixos/hardware/${hostName}.nix ];
networking.hostName = hostName;
};
user = import ./user.nix;
Expand Down
9 changes: 1 addition & 8 deletions lib/unfree.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
pkgs:

# List of all unfree packages authorized

let
inherit (builtins) elem;
inherit (pkgs.lib) getName;
in
package: elem (getName package) [
package: builtins.elem package.pname [
# NixOS
"steam"
"steam-original"
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ in
config = {
nixpkgs = {
overlays = [ overlays.all ];
config.allowUnfreePredicate = import ../../lib/unfree.nix pkgs;
config.allowUnfreePredicate = import ../../lib/unfree.nix;
};

nix = {
Expand Down

0 comments on commit 46b5445

Please sign in to comment.