Initial restructure of flake.nix

- Added nixpkgs-unstable input
- Added disko input
- Made nixosSystem & darwinSystem reusable with parameters
- Switched darwinConfigurations to use parameterized darwinSystem
- Switched nixosConfigurations to use parameterized darwinSystem
This commit is contained in:
Gene Liverman 2023-12-15 08:57:02 -05:00 committed by Gene Liverman
parent e3d1b896c2
commit 7d7a958da9
2 changed files with 125 additions and 68 deletions

40
flake.lock generated
View file

@ -17,6 +17,26 @@
"type": "github"
}
},
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1702569759,
"narHash": "sha256-Ze3AdEEsVZBRJ4wn13EZpV1Uubkzi59TkC4j2G9xoFI=",
"owner": "nix-community",
"repo": "disko",
"rev": "98ab91109716871f50ea8cb0e0ac7cc1e1e14714",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@ -143,6 +163,22 @@
"type": "indirect"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1702539185,
"narHash": "sha256-KnIRG5NMdLIpEkZTnN5zovNYc0hhXjAgv6pfd5Z4c7U=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "aa9d4729cbc99dabacb50e3994dcefb3ea0f7447",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1688049487,
@ -176,11 +212,13 @@
},
"root": {
"inputs": {
"disko": "disko",
"genebean-omp-themes": "genebean-omp-themes",
"home-manager": "home-manager",
"nix-darwin": "nix-darwin",
"nix-homebrew": "nix-homebrew",
"nixpkgs": "nixpkgs_3"
"nixpkgs": "nixpkgs_3",
"nixpkgs-unstable": "nixpkgs-unstable"
}
},
"systems": {

153
flake.nix
View file

@ -4,6 +4,7 @@
# Where we get most of our software. Giant mono repo with recipes
# called derivations that say how to build software.
nixpkgs.url = "github:nixos/nixpkgs";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
# Controls system level software and settings including fonts
nix-darwin = {
@ -20,6 +21,12 @@
# Manage Homebrew itself
nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew";
# Format disks with nix-config
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# My oh-my-posh theme
genebean-omp-themes = {
url = "github:genebean/my-oh-my-posh-themes";
@ -27,78 +34,90 @@
};
}; # end inputs
outputs = { self, nixpkgs, nix-darwin, home-manager, nix-homebrew, genebean-omp-themes, ... }: {
nixosConfigurations = let
user = "gene";
in {
rainbow-planet = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./modules/nixos
outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, nix-darwin, home-manager, nix-homebrew, disko, genebean-omp-themes, ... }: let
inputs = { inherit disko home-manager nixpkgs nixpkgs-unstable nix-darwin; };
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${user}.imports = [
./modules/home-manager
./modules/home-manager/nixos.nix
./modules/nixos/dconf.nix
];
extraSpecialArgs = { inherit genebean-omp-themes; };
};
}
];
}; # end rainbow-planet
}; # end nixosConfigurations
# This is only set to work with x86 macOS right now... that will need to be updated
darwinConfigurations = let
user = "gene.liverman";
in {
Blue-Rock = nix-darwin.lib.darwinSystem {
system = "x86_64-darwin";
pkgs = import nixpkgs {
system = "x86_64-darwin";
config = {
allowUnfree = true;
permittedInsecurePackages = [
"python-2.7.18.6"
];
};
# creates a nixos system config
nixosSystem = system: hostName: username: nixpkgs.lib.nixosSystem {
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
permittedInsecurePackages = [
"electron-21.4.4"
];
};
modules = [
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
# Install Homebrew under the default prefix
enable = true;
};
modules = [
./modules/nixos
# User owning the Homebrew prefix
user = "${user}";
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${username}.imports = [
./modules/home-manager
./modules/home-manager/nixos.nix
./modules/nixos/dconf.nix
];
extraSpecialArgs = { inherit genebean-omp-themes; };
};
}
];
# Automatically migrate existing Homebrew installations
autoMigrate = true;
};
}
}; # end nixosSystem
./modules/darwin
# creates a macOS system config
darwinSystem = system: hostName: username: nix-darwin.lib.darwinSystem {
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
permittedInsecurePackages = [
"python-2.7.18.6"
];
};
};
modules = [
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
# Install Homebrew under the default prefix
enable = true;
home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${user}.imports = [
./modules/home-manager
./modules/home-manager/darwin.nix
];
extraSpecialArgs = { inherit genebean-omp-themes; };
};
}
]; # end modules
}; # end Blue-Rock
}; # end darwinConfigurations
# User owning the Homebrew prefix
user = "${username}";
# Automatically migrate existing Homebrew installations
autoMigrate = true;
};
}
./modules/darwin
home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${username}.imports = [
./modules/home-manager
./modules/home-manager/darwin.nix
];
extraSpecialArgs = { inherit genebean-omp-themes; };
};
}
]; # end modules
}; # end darwinSystem
in {
darwinConfigurations = {
Blue-Rock = darwinSystem "x86_64-darwin" "Blue-Rock" "gene.liverman";
};
nixosConfigurations = {
rainbow-planet = nixosSystem "x86_64-linux" "rainbow-planet" "gene";
};
};
}