System/flake.nix

278 lines
8.9 KiB
Nix
Raw Normal View History

2021-12-20 13:37:26 -05:00
{
description = "Nathan's system configurations";
inputs = {
2023-05-30 09:18:20 -04:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.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 = {
2023-05-30 09:18:20 -04:00
url = "github:nix-community/home-manager/release-23.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";
};
2023-05-24 14:08:39 -04:00
emacs = {
url =
"github:nix-community/emacs-overlay/9b41f8296a3898bdb87b9d091f9df540a982b242";
};
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 = [
2022-07-03 00:43:50 -04:00
./machines/levitation/configuration.nix
./machines/levitation/hardware.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 = [
./machines/oracles/hardware.nix
./machines/oracles/configuration.nix
];
};
2022-09-26 23:31:01 -04:00
matrix = makeNixosSystem {
system = "x86_64-linux";
hostName = "matrix";
extraModules = [
./machines/matrix/hardware.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 {
2023-06-04 09:59:01 -04:00
system = "x86_64-linux";
2023-04-08 23:20:43 -04:00
hostName = "perception";
extraModules = [
./machines/perception/configuration.nix
./machines/perception/hardware.nix
2023-04-08 23:20:43 -04:00
];
};
2022-11-23 20:36:59 -05:00
fusion = makeNixosSystem {
system = "aarch64-linux";
hostName = "fusion";
extraModules = [
./machines/fusion/hardware.nix
./machines/fusion/configuration.nix
];
2022-11-23 20:36:59 -05:00
};
2023-06-04 09:59:01 -04:00
pendulum = makeNixosSystem {
system = "x86_64-linux";
hostName = "pendulum";
extraModules = [
./machines/pendulum/hardware.nix
./machines/pendulum/configuration.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 ];
};
2023-04-25 23:39:37 -04:00
# VMs
productivity-vm = makeNixosSystem {
system = "x86_64-linux";
hostName = "productivity-vm";
extraModules = [
./machines/productivity-vm/configuration.nix
./machines/productivity-vm/hardware.nix
2023-04-25 23:39:37 -04:00
];
};
2023-05-30 03:10:12 -04:00
# Installer iso
iso_x86_64 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma5.nix"
"${nixpkgs}/nixos/modules/installer/cd-dvd/channel.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-06-06 18:13:56 -04:00
version = "0.0.157";
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-06-06 18:13:56 -04:00
hash = "sha256-T6y5xOmRVx2hrih2vo2qFwODJ4Fb8FMMxQ5WH6AkXvw=";
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 { };
2023-04-19 20:34:45 -04:00
layman = pkgs.callPackage ./packages/layman/default.nix { };
2022-10-29 20:06:49 -04:00
};
});
2021-12-20 13:37:26 -05:00
}