nix-dotfiles/flake.nix

239 lines
6.2 KiB
Nix

{
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.05";
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager-local = {
url = "git+file:///home/h7x4/git/home-manager";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
dotfiles = {
url = "git+https://git.nani.wtf/h7x4/dotfiles?ref=master";
flake = false;
};
nix-attr-search ={
url = "github:h7x4/nix-attr-search";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
fonts = {
url = "path:/home/h7x4/git/fonts";
flake = false;
};
sops-nix.url = "github:Mic92/sops-nix";
osuchan = {
url = "git+file:///home/h7x4/git/osuchan-line-bot";
inputs.nixpkgs.follows = "nixpkgs";
};
website = {
url = "git+https://git.nani.wtf/h7x4/nani.wtf?ref=main";
# url = "path:/home/h7x4/git/nani.wtf";
# inputs.nixpkgs.follows = "nixpkgs";
};
maunium-stickerpicker = {
url = "git+file:///home/h7x4/git/maunium-stickerpicker-nix";
};
minecraft = {
url = "github:infinidoge/nix-minecraft";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
matrix-synapse-next = {
url = "github:dali99/nixos-matrix-modules";
};
vscode-server = {
url = "github:nix-community/nixos-vscode-server";
};
# Nix expressions and keys (TODO: move keys to another solution like agenix)
# which should be kept from the main repo for privacy reasons.
#
# Includes stuff like usernames, emails, ports, other server users, ssh hosts, etc.
secrets = {
# TODO: Push this to a remote.
url = "git+file:///home/h7x4/git/nix-secrets";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{
self,
nixpkgs,
nixpkgs-unstable,
home-manager,
home-manager-local,
dotfiles,
fonts,
matrix-synapse-next,
maunium-stickerpicker,
minecraft,
nix-attr-search,
osuchan,
secrets,
sops-nix,
vscode-server,
website
}: let
system = "x86_64-linux";
pkgs-config = {
inherit system;
config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
overlays = let
nonrecursive-unstable-pkgs = nixpkgs-unstable.legacyPackages.${system};
in [
(self: super: { kanidm = nonrecursive-unstable-pkgs.kanidm; })
(self: super: { pgadmin4 = nonrecursive-unstable-pkgs.pgadmin4; })
(self: super: { pcloud = unstable-pkgs.callPackage ./package-overrides/pcloud.nix {}; })
osuchan.overlays.default
(self: super: {
mpv-unwrapped = super.mpv-unwrapped.override {
ffmpeg_5 = super.ffmpeg_5-full;
};
})
# (self: super: {
# systemd = super.systemd.overrideAttrs (final: prev: {
# mesonFlags = prev.mesonFlags ++ [ "-Dsystemd-socket-proxyd=true" ];
# });
# })
];
};
pkgs = import nixpkgs pkgs-config;
unstable-pkgs = import nixpkgs-unstable pkgs-config;
in {
extendedLib = import ./lib { stdlib = pkgs.lib; };
inherit pkgs;
packages.${system} = {
inherit (pkgs) kanidm pcloud;
};
devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [ sops ];
};
homeConfigurations = {
h7x4 = home-manager.lib.homeManagerConfiguration {
inherit system;
inherit pkgs;
username = "h7x4";
homeDirectory = "/home/h7x4";
stateVersion = "22.05";
configuration = {
imports = [
./home/home.nix
./modules/machineVars.nix
];
machineVars = {
headless = false;
fixDisplayCommand = "echo 'not available'";
gaming = true;
development = true;
laptop = false;
};
};
};
};
nixosConfigurations = let
nixSys = name:
nixpkgs.lib.nixosSystem {
inherit system;
inherit pkgs;
inherit (pkgs) lib;
modules = [
"${home-manager}/nixos"
./modules/machineVars.nix
./modules/socketActivation.nix
./hosts/common.nix
./hosts/${name}/configuration.nix
matrix-synapse-next.nixosModules.synapse
osuchan.outputs.nixosModules.default
secrets.outputs.nixos-config
sops-nix.nixosModules.sops
vscode-server.nixosModules.default
(args: import minecraft.outputs.nixosModules.minecraft-servers (args // {
pkgs = unstable-pkgs;
lib = unstable-pkgs.lib;
}))
{
config._module.args = {
inherit inputs;
inherit unstable-pkgs;
inherit (self) extendedLib;
secrets = secrets.outputs.settings;
};
}
({ config, ... }:
{
home-manager = {
useGlobalPkgs = true;
extraSpecialArgs = {
inherit inputs;
inherit (self) extendedLib;
secrets = secrets.outputs.settings;
};
users.h7x4 = import ./home/home.nix {
inherit pkgs;
inherit inputs;
inherit (pkgs) lib;
inherit (config) machineVars;
inherit (self) extendedLib;
};
};
})
];
};
in {
Tsuki = nixSys "tsuki";
Eisei = nixSys "eisei";
kasei = nixSys "kasei";
home-manager-tester = nixpkgs-unstable.lib.nixosSystem {
inherit system;
pkgs = unstable-pkgs;
inherit (unstable-pkgs) lib;
modules = [
"${home-manager-local}/nixos"
./hosts/special/home-manager-tester/configuration.nix
{
config._module.args = {
pkgs = unstable-pkgs;
# inherit (self) extendedLib;
# secrets = secrets.outputs.settings;
};
}
];
};
};
};
}