System/flake.nix

244 lines
7.8 KiB
Nix
Raw Normal View History

2021-12-20 13:37:26 -05:00
{
description = "Nathan's system configurations";
inputs = {
2022-05-30 21:47:04 -04:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
2021-12-20 13:37:26 -05:00
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
2022-10-02 22:37:07 -04:00
nixos-hardware.url = "github:NixOS/nixos-hardware";
home-manager = {
url = "github:nix-community/home-manager/release-22.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-on-droid = {
url = "github:t184256/nix-on-droid";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
2022-10-29 20:06:49 -04:00
flake-utils.url = "github:numtide/flake-utils";
darwin = {
url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-12-20 13:37:26 -05:00
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
2021-12-20 13:37:26 -05:00
};
emacs = {
2022-06-23 02:57:41 -04:00
url = "github:nix-community/emacs-overlay";
2022-09-30 22:27:34 -04:00
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
2022-05-17 00:18:49 -04:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-10-18 09:54:58 -04:00
prismlauncher = {
url = "github:PrismLauncher/PrismLauncher";
2022-06-01 13:02:33 -04:00
inputs.nixpkgs.follows = "nixpkgs";
2022-04-19 19:39:39 -04:00
};
2022-06-14 01:00:09 -04:00
java = {
url = "github:nathans-flakes/java";
inputs.nixpkgs.follows = "nixpkgs";
};
quilt-server = {
url = "github:forward-progress/quilt-server-nix-container";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-07-06 01:42:31 -04:00
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
wsl = {
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-08-01 18:10:41 -04:00
gamescope = {
url = "github:nathans-flakes/gamescope";
2022-10-13 00:03:16 -04:00
inputs = {
nixpkgs.follows = "nixpkgs";
nixpkgs-unstable.follows = "nixpkgs-unstable";
};
2022-10-23 09:52:34 -04:00
};
idris2 = {
url = "github:idris-lang/idris2";
inputs.nixpkgs.follows = "nixpkgs";
2022-08-01 18:10:41 -04:00
};
2021-12-20 13:37:26 -05:00
};
2022-10-29 20:06:49 -04:00
outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils, nixos-hardware
, fenix, emacs, sops-nix, home-manager, darwin, prismlauncher, java
, quilt-server, nixos-generators, wsl, gamescope, nix-on-droid, idris2
}@inputs:
2021-12-23 00:45:21 -05:00
let
makeNixosSystem =
{ system, hostName, extraModules ? [ ], ourNixpkgs ? nixpkgs }:
ourNixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inputs = inputs; };
modules = [
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
./modules/linux/default.nix
({ pkgs, lib, config, ... }: {
# Configure hostname
networking = { hostName = hostName; };
# Setup sops
# Add default secrets
sops = { age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; };
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = (pkg: true);
# Home manager configuration
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = {
inputs = inputs;
nixosConfig = config;
};
sharedModules = [ ./home-manager/linux/default.nix ];
};
})
] ++ extraModules;
2022-05-18 01:09:25 -04:00
};
makeDarwinSystem = { system, extraModules ? [ ] }:
darwin.lib.darwinSystem {
inherit system;
specialArgs = { inputs = inputs; };
modules = [
home-manager.darwinModules.home-manager
./modules/darwin/default.nix
({ pkgs, lib, config, ... }: {
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = (pkg: true);
# Home manager configuration
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = {
inputs = inputs;
nixosConfig = config;
};
sharedModules = [ ./home-manager/darwin/default.nix ];
2022-06-23 02:57:41 -04:00
};
})
] ++ extraModules;
};
in rec {
2022-07-06 01:42:31 -04:00
# Real systems
nixosConfigurations = {
2022-06-23 02:57:41 -04:00
levitation = makeNixosSystem {
system = "x86_64-linux";
2022-06-23 02:57:41 -04:00
hostName = "levitation";
extraModules = [
./hardware/levitation.nix
2022-07-03 00:43:50 -04:00
./machines/levitation/configuration.nix
2022-06-23 02:57:41 -04:00
];
2022-05-13 22:36:53 -04:00
};
oracles = makeNixosSystem {
system = "x86_64-linux";
hostName = "oracles";
extraModules =
[ ./hardware/oracles.nix ./machines/oracles/configuration.nix ];
};
2022-09-26 23:31:01 -04:00
matrix = makeNixosSystem {
system = "x86_64-linux";
hostName = "matrix";
extraModules =
[ ./hardware/matrix.nix ./machines/matrix/configuration.nix ];
2022-09-26 23:31:01 -04:00
};
2022-10-02 22:37:07 -04:00
tounge = makeNixosSystem {
system = "aarch64-linux";
hostName = "tounge";
extraModules = [ ./machines/tounge/configuration.nix ];
2022-10-02 22:37:07 -04:00
};
2022-06-23 02:57:41 -04:00
x86vm = makeNixosSystem {
2022-05-14 01:09:02 -04:00
system = "x86_64-linux";
2022-06-23 02:57:41 -04:00
hostName = "x86vm";
extraModules = [
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
"${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix"
2022-07-03 00:43:50 -04:00
./machines/x86vm/configuration.nix
];
2021-12-23 00:47:40 -05:00
};
2022-07-06 01:42:31 -04:00
# WSL sytem
wsl = makeNixosSystem {
system = "x86_64-linux";
hostName = "wsl";
extraModules =
[ wsl.nixosModules.wsl ./machines/wsl/configuration.nix ];
};
};
# Mac systems
darwinConfigurations = {
"extremophile" = makeDarwinSystem {
system = "x86_64-darwin";
extraModules = [ ./machines/extremophile/configuration.nix ];
2022-07-06 01:42:31 -04:00
};
};
# Android systems
nixOnDroidConfigurations = {
tablet = nix-on-droid.lib.nixOnDroidConfiguration {
config = ./machines/tablet/configuration.nix;
system = "aarch64-linux";
2022-09-04 02:46:27 -04:00
extraModules = [
./modules/nix-on-droid/default.nix
2022-09-04 03:21:18 -04:00
({ pkgs, lib, config, ... }: {
# Home manager configuration
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = {
inputs = inputs;
nixosConfig = config;
};
sharedModules = [ ./home-manager/nix-on-droid/default.nix ];
2022-09-04 03:21:18 -04:00
};
})
2022-09-04 02:46:27 -04:00
];
};
};
2022-07-06 01:42:31 -04:00
packages = {
x86_64-linux = {
# Hyper-V image
hyperv = nixos-generators.nixosGenerate {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [ ./machines/hyperv/configuration.nix ];
2022-07-06 01:42:31 -04:00
format = "hyperv";
};
};
2021-12-23 00:47:40 -05:00
};
2022-10-29 20:06:49 -04:00
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
# Special handling for discord, as it's unfree _and_ insecure!
config = {
allowUnfree = true;
permittedInsecurePackages = [ "electron-13.6.9" ];
};
};
in {
packages = flake-utils.lib.flattenTree {
discordWayland = pkgs.callPackage ./packages/discord/default.nix rec {
pname = "discord-electron";
binaryName = "Discord";
desktopName = "Discord (Wayland)";
version = "0.0.21";
src = pkgs.fetchurl {
url =
"https://dl.discordapp.net/apps/linux/${version}/discord-${version}.tar.gz";
hash = "sha256-KDKUssPRrs/D10s5GhJ23hctatQmyqd27xS9nU7iNaM=";
};
electron = pkgs.electron_13;
};
swayimg = pkgs.callPackage ./packages/swayimg/default.nix { };
};
});
2021-12-20 13:37:26 -05:00
}