Universe/flake.nix

163 lines
5.2 KiB
Nix

# Universe - The big bang to my universe
#
# Copyright (c) 2023-2024 Sameer Rahmani <lxsameer@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
{
description = "lxsameer's universe";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/442d407992384ed9c0e6d352de75b69079904e4e";
nixos-hardware.url = "github:nixos/nixos-hardware";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/517601b37c6d495274454f63c5a483c8e3ca6be1";
inputs.nixpkgs.follows = "nixpkgs";
};
fg42.url = "git+https://devheroes.codes/FG42/FG42";
#fg42.url = "/home/lxsameer/src/fg42";
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
stylix.url = "github:danth/stylix/fcff15ac5ffbe81f1c66e352f3167c270d79cdab";
# TODO: Checkout hercules
# hercules-ci-agent.url = "github:hercules-ci/hercules-ci-agent";
# To build and android image
# robotnix.url = "github:danielfullmer/robotnix";
# impermanence.url = "github:nix-community/impermanence";
disko.url = "github:nix-community/disko";
};
outputs = { self, nixpkgs, ... } @ inputs:
let
# I just use linux and currently only x86_64
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
universe_version = "23.11.0.0";
})
];
};
utils = pkgs.callPackage ./utils { };
modules = pkgs.callPackage ./modules {
inherit system pkgs;
inherit (inputs) nixos-generators;
};
nativeBuildInputs = with pkgs; [
libslirp
qemu
fish
zstd
utils.scripts
rage
inputs.agenix.packages.${system}.agenix
];
defaultParams = {
inherit nixpkgs inputs system pkgs modules utils;
inherit (inputs) sops;
hostBuilderConfig = {
inVM = false;
};
};
in
rec{
inherit pkgs;
packages.${system} = {
majin = nixosConfigurations.majin;
majinVM = nixosConfigurations.majinVM;
majinInstaller = nixosConfigurations.majinInstaller.config.formats.iso;
majinInstallerVM = nixosConfigurations.majinInstallerVM.config.formats.iso;
boot-majin = utils.bootImage packages.${system}.majinVM;
boot-majin-installer = utils.bootImage packages.${system}.majinInstallerVM;
x1 = nixosConfigurations.x1;
x1VM = nixosConfigurations.x1VM;
x1Installer = nixosConfigurations.x1Installer.config.formats.iso;
x1InstallerVM = nixosConfigurations.x1InstallerVM.config.formats.iso;
boot-x1 = utils.bootImage packages.${system}.x1VM;
boot-x1-installer = utils.bootImage packages.${system}.x1InstallerVM;
maryland = nixosConfigurations.maryland;
marylandVM = nixosConfigurations.marylandVM;
marylandInstaller = nixosConfigurations.marylandInstaller.config.formats.iso;
marylandInstallerVM = nixosConfigurations.marylandInstallerVM.config.formats.iso;
boot-maryland = utils.bootImage packages.${system}.marylandVM;
boot-maryland-installer = utils.bootImage packages.${system}.marylandInstallerVM;
inherit (utils) create-disk;
};
nixosConfigurations = {
majin = (import ./worlds/majin.nix defaultParams).majin;
majinInstaller = (import ./worlds/majin.nix defaultParams).installer;
majinVM = (import ./worlds/majin.nix (defaultParams // {
hostBuilderConfig.inVM = true;
})).majin;
majinInstallerVM = (import ./worlds/majin.nix (defaultParams // {
hostBuilderConfig.inVM = true;
})).installer;
x1 = (import ./worlds/x1.nix defaultParams).x1;
x1Installer = (import ./worlds/x1.nix defaultParams).installer;
x1VM = (import ./worlds/x1.nix (defaultParams // {
hostBuilderConfig.inVM = true;
})).x1;
x1InstallerVM = (import ./worlds/x1.nix (defaultParams // {
hostBuilderConfig.inVM = true;
})).installer;
maryland = (import ./worlds/maryland.nix defaultParams).maryland;
marylandInstaller = (import ./worlds/maryland.nix defaultParams).installer;
marylandVM = (import ./worlds/maryland.nix (defaultParams // {
hostBuilderConfig.inVM = true;
})).maryland;
marylandInstallerVM = (import ./worlds/maryland.nix (defaultParams // {
hostBuilderConfig.inVM = true;
})).installer;
};
devShells.${system}.default = pkgs.mkShell {
inherit nativeBuildInputs;
shellHook = ''
fish && exit
'';
};
};
}