System/flake.nix

244 lines
7.9 KiB
Nix
Raw Normal View History

2021-12-20 13:37:26 -05:00
{
description = "Nathan's system configurations";
inputs = {
2022-11-23 20:43:20 -05:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
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 = {
2022-11-23 20:43:20 -05:00
url = "github:nix-community/home-manager/release-22.11";
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
};
2023-04-18 16:50:20 -04:00
emacs = { url = "github:nix-community/emacs-overlay"; };
2022-05-17 00:18:49 -04:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-06-14 01:00:09 -04:00
java = {
2022-11-29 04:46:34 -05:00
url = "git+https://git.stranger.systems/nix/java";
2022-06-14 01:00:09 -04:00
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-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
};
2022-11-02 01:53:51 -04:00
scripts.url = "git+https://git.sr.ht/~thatonelutenist/Scripts?ref=trunk";
2021-12-20 13:37:26 -05:00
};
2023-03-02 00:21:37 -05:00
outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils, sops-nix
, home-manager, darwin, nixos-generators, wsl, nix-on-droid, ... }@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
};
2023-04-08 23:20:43 -04:00
perception = makeNixosSystem {
system = "x86_4-linux";
hostName = "perception";
extraModules = [
./machines/perception/configuration.nix
./hardware/perception.nix
];
};
2022-11-23 20:36:59 -05:00
fusion = makeNixosSystem {
system = "aarch64-linux";
hostName = "fusion";
extraModules =
[ ./machines/fusion/configuration.nix ./hardware/fusion.nix ];
};
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 {
2023-03-27 16:45:21 -04:00
system = "aarch64-darwin";
extraModules = [ ./machines/extremophile/configuration.nix ];
2022-07-06 01:42:31 -04:00
};
};
# Android systems
nixOnDroidConfigurations = {
tablet = nix-on-droid.lib.nixOnDroidConfiguration {
2022-11-17 16:37:09 -05:00
modules = [
./machines/tablet/configuration.nix
2022-09-04 02:46:27 -04:00
./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;
2023-03-03 19:05:10 -05:00
permittedInsecurePackages = [ "electron-16.2.3" ];
2022-10-29 20:06:49 -04:00
};
};
in {
packages = flake-utils.lib.flattenTree {
discordWayland = pkgs.callPackage ./packages/discord/default.nix rec {
pname = "discord-electron";
2023-03-03 19:05:10 -05:00
binaryName = "DiscordCanary";
2022-10-29 20:06:49 -04:00
desktopName = "Discord (Wayland)";
2023-04-19 20:01:14 -04:00
version = "0.0.151";
2022-10-29 20:06:49 -04:00
src = pkgs.fetchurl {
url =
2023-03-03 19:05:10 -05:00
"https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz";
2023-04-19 20:01:14 -04:00
hash = "sha256-ZN+lEGtSajgYsyMoGRmyTZCpUGVmb9LKgVv89NA4m7U=";
2022-10-29 20:06:49 -04:00
};
2023-03-03 19:05:10 -05:00
electron = pkgs.electron_22;
2022-10-29 20:06:49 -04:00
};
swayimg = pkgs.callPackage ./packages/swayimg/default.nix { };
};
});
2021-12-20 13:37:26 -05:00
}