nix-home/flake.nix

168 lines
5.6 KiB
Nix
Raw Normal View History

2021-10-26 18:25:19 +00:00
{
description = "nki's systems";
2021-10-26 18:25:19 +00:00
inputs = {
2022-05-28 16:31:11 +00:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
2021-10-26 18:25:19 +00:00
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
darwin.url = "github:lnl7/nix-darwin/master";
darwin.inputs.nixpkgs.follows = "nixpkgs-unstable";
2022-05-28 16:31:11 +00:00
home-manager.url = "github:nix-community/home-manager/release-22.05";
2021-12-01 18:52:13 +00:00
home-manager.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
deploy-rs.url = "github:Serokell/deploy-rs";
nur.url = "github:nix-community/NUR";
2021-10-29 04:25:58 +00:00
2022-05-31 16:45:33 +00:00
flake-utils.url = github:numtide/flake-utils;
2021-10-29 04:25:58 +00:00
# ---
# Imported apps
rnix-lsp.url = "github:nix-community/rnix-lsp";
2021-10-29 17:31:16 +00:00
rnix-lsp.inputs.nixpkgs.follows = "nixpkgs-unstable";
2021-11-03 19:01:23 +00:00
youmubot.url = "github:natsukagami/youmubot";
2022-04-30 00:07:50 +00:00
youmubot.inputs.nixpkgs.follows = "nixpkgs";
2021-12-09 20:54:26 +00:00
nix-gaming.url = github:fufexan/nix-gaming;
# --- Sources
kakoune.url = github:mawww/kakoune;
kakoune.flake = false;
kak-lsp.url = github:kak-lsp/kak-lsp;
kak-lsp.flake = false;
# ---
# DEPLOYMENT ONLY! secrets
2022-06-10 02:41:37 +00:00
secrets.url = "git+ssh://git@github.com/natsukagami/nix-deploy-secrets";
2021-10-26 18:25:19 +00:00
};
2021-12-01 18:52:13 +00:00
outputs = { self, darwin, nixpkgs, nixpkgs-unstable, home-manager, deploy-rs, sops-nix, nur, ... }@inputs:
2021-10-29 17:31:16 +00:00
let
2022-07-04 19:41:04 +00:00
overlays = import ./overlay.nix inputs;
2021-12-09 20:54:26 +00:00
2022-07-14 00:11:24 +00:00
pkgs' = system: import nixpkgs { inherit system overlays; config.allowUnfree = true; };
pkgs-unstable = system: import nixpkgs-unstable { inherit system overlays; config.allowUnfree = true; };
2022-07-04 19:41:04 +00:00
nixpkgsAsRegistry_ = stable: { ... }: {
nix.registry.nixpkgs.flake = stable;
2021-12-09 20:54:26 +00:00
nix.registry.nixpkgs-unstable.flake = nixpkgs-unstable;
nix.nixPath = [
"nixpkgs=${nixpkgs}"
"nixpkgs-unstable=${nixpkgs-unstable}"
"/nix/var/nix/profiles/per-user/root/channels"
];
};
2022-07-04 19:41:04 +00:00
nixpkgsAsRegistry = nixpkgsAsRegistry_ nixpkgs;
haskellDotNix = { ... }: {
# Binary Cache for Haskell.nix
nix.binaryCachePublicKeys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];
nix.binaryCaches = [
"https://cache.iog.io"
];
};
2021-12-09 20:54:26 +00:00
enableOsuStable = { lib, ... }: {
imports = [ inputs.nix-gaming.nixosModules.pipewireLowLatency ];
services.pipewire = {
enable = true;
# alsa is optional
alsa.enable = true;
alsa.support32Bit = true;
# needed for osu
pulse.enable = true;
lowLatency.enable = true;
};
hardware.pulseaudio.enable = lib.mkOverride 0 false;
nix.binaryCaches = [ "https://nix-gaming.cachix.org" ];
nix.binaryCachePublicKeys = [ "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" ];
environment.systemPackages = [ inputs.nix-gaming.packages.x86_64-linux.osu-stable ];
};
2021-10-29 17:31:16 +00:00
in
{
# MacBook configuration: nix-darwin + home-manager
2022-07-04 19:41:04 +00:00
darwinConfigurations."nki-macbook" = darwin.lib.darwinSystem rec {
2021-10-29 17:31:16 +00:00
system = "aarch64-darwin";
2022-07-04 19:41:04 +00:00
pkgs = pkgs-unstable system;
2021-10-29 17:31:16 +00:00
modules = [
./darwin/configuration.nix
2022-05-12 22:56:30 +00:00
# Set nix path
2022-07-04 19:41:04 +00:00
haskellDotNix
(nixpkgsAsRegistry_ nixpkgs-unstable)
2021-12-01 18:52:13 +00:00
home-manager.darwinModules.home-manager
2021-10-26 18:25:19 +00:00
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
2021-10-27 16:35:53 +00:00
home-manager.users.nki = import ./home/macbook-home.nix;
2021-10-29 17:31:16 +00:00
}
];
};
2021-10-29 17:31:16 +00:00
# Home configuration
2022-07-04 19:41:04 +00:00
nixosConfigurations."nki-home" = nixpkgs.lib.nixosSystem rec {
2021-10-29 17:31:16 +00:00
system = "x86_64-linux";
2022-07-14 00:11:24 +00:00
pkgs = pkgs' system;
2021-10-29 17:31:16 +00:00
modules = [
./modules/my-tinc
sops-nix.nixosModules.sops
./nki-home/configuration.nix
2021-12-09 20:54:26 +00:00
nixpkgsAsRegistry
enableOsuStable
2021-12-01 18:52:13 +00:00
home-manager.nixosModules.home-manager
2021-10-29 17:31:16 +00:00
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nki = import ./home/kagami-pc-home.nix;
}
2022-05-03 14:30:53 +00:00
inputs.secrets.nixosModules.x86_64-linux.common
2021-10-29 17:31:16 +00:00
];
};
2022-04-19 20:46:33 +00:00
# x1c1 configuration
2022-07-04 19:41:04 +00:00
nixosConfigurations."nki-x1c1" = nixpkgs.lib.nixosSystem rec {
2022-07-14 00:11:24 +00:00
pkgs = pkgs' system;
2022-04-19 20:46:33 +00:00
system = "x86_64-linux";
modules = [
./modules/my-tinc
sops-nix.nixosModules.sops
./nki-x1c1/configuration.nix
nixpkgsAsRegistry
2022-04-19 21:44:08 +00:00
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nki = import ./home/nki-x1c1.nix;
}
2022-04-19 20:46:33 +00:00
];
};
# DigitalOcean node
2022-07-04 19:41:04 +00:00
nixosConfigurations."nki-personal-do" = nixpkgs.lib.nixosSystem rec {
2022-07-14 00:11:24 +00:00
pkgs = pkgs' system;
system = "x86_64-linux";
modules = [
./modules/my-tinc
2021-11-03 17:22:27 +00:00
inputs.youmubot.nixosModule.x86_64-linux
sops-nix.nixosModules.sops
./nki-personal-do/configuration.nix
inputs.secrets.nixosModules.x86_64-linux.nki-personal-do
];
};
deploy.nodes."nki-personal-do" = {
hostname = "nki-personal-do";
sshUser = "root";
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."nki-personal-do";
};
};
# This is highly advised, and will prevent many possible mistakes
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
2022-05-31 16:45:33 +00:00
} // (inputs.flake-utils.lib.eachDefaultSystem (system: {
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
}));
2021-10-26 18:25:19 +00:00
}