dotnix/flake.nix

173 lines
4.7 KiB
Nix

{
description = "jolheiser's nixos config";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs-py36.url = "github:nixos/nixpkgs/34f85de51bbc74595e63b22ee089adbb31f7c7a2";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs = {
nixpkgs.follows = "nixpkgs";
darwin.follows = "";
home-manager.follows = "";
};
};
flake-utils.url = "github:numtide/flake-utils";
nur.url = "github:nix-community/NUR";
jolheiser-nur = {
url = "git+https://git.jojodev.com/jolheiser/nur";
inputs.nixpkgs.follows = "nixpkgs";
};
helix = {
url = "git+https://git.jojodev.com/jolheiser/helix.drv";
inputs.nixpkgs.follows = "nixpkgs";
};
# Other flakes
golink = {
url = "github:tailscale/golink";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
tclip = {
url = "github:tailscale-dev/tclip";
inputs = {
nixpkgs.follows = "nixpkgs";
utils.follows = "flake-utils";
};
};
};
outputs = {
self,
nixpkgs,
home-manager,
agenix,
jolheiser-nur,
helix,
nixpkgs-py36,
golink,
tclip,
...
} @ inputs: let
overlays = [
(final: prev: {
nur = import inputs.nur {
nurpkgs = prev;
pkgs = prev;
};
jolheiser = inputs.jolheiser-nur.packages.${prev.system};
tclip = inputs.tclip.packages.${prev.system}.tclip;
jolheiser-helix = inputs.helix.packages.${prev.system}.default;
})
golink.overlay
];
commonConfig = {gui ? true}: {
config,
pkgs,
...
}: let
userSecret = path: {
file = path;
owner = username;
};
in {
config = {
nixpkgs.overlays = overlays;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${username}.imports =
if gui
then [./apps/gui]
else [./apps/nogui];
extraSpecialArgs = {
flakePath = "/home/${username}/.config/nixpkgs";
};
};
age.secrets = {
ssh-config = userSecret ./secrets/shared/ssh-config.age;
ssh-config-work = userSecret ./secrets/shared/ssh-config-work.age;
spotify-pw = userSecret ./secrets/shared/spotify-pw.age;
irc-pw = userSecret ./secrets/shared/irc-pw.age;
};
};
};
username = "jolheiser";
in
{
nixosConfigurations = {
"chai" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
agenix.nixosModules.default
./machines/chai
(commonConfig {})
({pkgs, ...}: {
config = {
nixpkgs.overlays = [
(_: _: {
py36 = import nixpkgs-py36 {inherit (pkgs) system;};
})
];
home-manager.users.${username}.programs = {
git.package = pkgs.gitSVN;
firefox.profiles.default.bookmarks = [(import ./apps/gui/firefox/work.nix)];
};
age.secrets = {
netrc = {
file = ./secrets/work/netrc.age;
owner = username;
path = "/home/${username}/.netrc";
};
pipconf = {
file = ./secrets/work/pip.conf.age;
owner = username;
path = "/home/${username}/.config/pip/pip.conf";
};
};
};
})
];
};
"matcha" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
agenix.nixosModules.default
./machines/matcha
(commonConfig {})
];
};
"dragonwell" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
agenix.nixosModules.default
golink.nixosModules.default
./machines/dragonwell
(commonConfig {gui = false;})
];
};
};
}
// inputs.flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
agenix.packages.${system}.agenix
];
};
});
}