Finish the first version of the installer
This commit is contained in:
parent
377cb5504a
commit
bc9a7f1f86
|
@ -1,7 +1,4 @@
|
|||
keys:
|
||||
- &main age150sgqcr35yfxypeyfz0f8yxxkcwy55j076qetjpd5zsxen9xnd9qum72py
|
||||
creation_rules:
|
||||
- path_regex: secrets/secrets.yaml
|
||||
key_groups:
|
||||
- age:
|
||||
- *main
|
||||
- path_regex: users/lxsameer/
|
||||
pgp: >-
|
||||
90F8357A163ACEAC21AE9E94ECFB937B2E7A433D
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
# 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/>.
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
}:
|
||||
stdenv.mkDerivation (final: {
|
||||
pname = "universe";
|
||||
version = "23.11.0.0";
|
||||
|
||||
|
||||
src = ../.;
|
||||
|
||||
doUnpack = false;
|
||||
doCheck = false;
|
||||
doInstall = false;
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p $out/
|
||||
cp -rv ${final.src}/* $out/
|
||||
'';
|
||||
})
|
24
flake.lock
24
flake.lock
|
@ -28,16 +28,18 @@
|
|||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"dirtyRev": "d2713dab3907cacba21bde64d68289bbb6fb495f-dirty",
|
||||
"dirtyShortRev": "d2713da-dirty",
|
||||
"lastModified": 1708530364,
|
||||
"lastModified": 1708611597,
|
||||
"narHash": "sha256-os+zgz16WsM8kLirJ+SX4+sUqHArmdmZi5u3tG+ksK8=",
|
||||
"ref": "v4",
|
||||
"rev": "688c76af875a26c7ae3229937cd86bd79cf0e102",
|
||||
"revCount": 1045,
|
||||
"type": "git",
|
||||
"url": "file:///home/lxsameer/.fg42"
|
||||
"url": "https://devheroes.codes/FG42/FG42"
|
||||
},
|
||||
"original": {
|
||||
"ref": "v4",
|
||||
"type": "git",
|
||||
"url": "file:///home/lxsameer/.fg42"
|
||||
"url": "https://devheroes.codes/FG42/FG42"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
|
@ -232,17 +234,17 @@
|
|||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1708564076,
|
||||
"narHash": "sha256-KKkqoxlgx9n3nwST7O2kM8tliDOijiSSNaWuSkiozdQ=",
|
||||
"lastModified": 1707451808,
|
||||
"narHash": "sha256-UwDBUNHNRsYKFJzyTMVMTF5qS4xeJlWoeyJf+6vvamU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "98b00b6947a9214381112bdb6f89c25498db4959",
|
||||
"rev": "442d407992384ed9c0e6d352de75b69079904e4e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "442d407992384ed9c0e6d352de75b69079904e4e",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
|
@ -254,10 +256,10 @@
|
|||
"nixos-generators": "nixos-generators",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"sops-nix": "sops-nix"
|
||||
"sops": "sops"
|
||||
}
|
||||
},
|
||||
"sops-nix": {
|
||||
"sops": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
|
|
45
flake.nix
45
flake.nix
|
@ -17,8 +17,8 @@
|
|||
description = "lxsameer's universe";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; #442d407992384ed9c0e6d352de75b69079904e4e
|
||||
sops-nix = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/442d407992384ed9c0e6d352de75b69079904e4e";
|
||||
sops = {
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
@ -34,13 +34,8 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# fg42 = {
|
||||
# type = "git";
|
||||
# url = "git@git.devheroes.codes:FG42/FG42.git";
|
||||
# ref = "v4";
|
||||
# };
|
||||
|
||||
fg42.url = "/home/lxsameer/.fg42";
|
||||
fg42.url = "git+https://devheroes.codes/FG42/FG42?ref=v4";
|
||||
#fg42.url = "/home/lxsameer/.fg42";
|
||||
|
||||
flake_utils.url = "github:numtide/flake-utils";
|
||||
|
||||
|
@ -64,6 +59,7 @@
|
|||
};
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
libslirp
|
||||
qemu
|
||||
fish
|
||||
zstd
|
||||
|
@ -71,21 +67,40 @@
|
|||
sops
|
||||
];
|
||||
|
||||
defaultParams = {
|
||||
inherit nixpkgs inputs system pkgs modules utils;
|
||||
inherit (inputs) sops;
|
||||
hostBuilderConfig = {
|
||||
inVM = false;
|
||||
};
|
||||
};
|
||||
|
||||
in rec{
|
||||
inherit pkgs;
|
||||
|
||||
packages.${system} = {
|
||||
majin = nixosConfigurations.majin.config.formats.iso;
|
||||
boot-majin = utils.bootImage packages.${system}.majin;
|
||||
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;
|
||||
inherit (utils) create-disk;
|
||||
};
|
||||
|
||||
|
||||
nixosConfigurations = {
|
||||
majin = import ./worlds/majin.nix {
|
||||
inherit nixpkgs inputs system pkgs;
|
||||
mods = modules;
|
||||
};
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
|
|
|
@ -31,82 +31,114 @@ rec {
|
|||
|
||||
};
|
||||
|
||||
base = {config, lib, pkgs, ...}: {
|
||||
base = {config, lib, pkgs, inputs, ...}:
|
||||
let
|
||||
universePkg = pkgs.callPackage ../derivations/universe.nix {};
|
||||
in {
|
||||
# point the system nixpkgs to this flake by indirecting through
|
||||
# /etc so it changes when the system switches without having to
|
||||
# restart all the terminals. thanks ElvishJerricco
|
||||
nix.registry = builtins.mapAttrs (n: flake: { inherit flake; }) inputs;
|
||||
|
||||
# Neverever change this value
|
||||
system.stateVersion = "23.11";
|
||||
environment.etc = lib.mapAttrs' (name: flake: {
|
||||
name = "nix/inputs/${name}";
|
||||
value.source = flake.outPath;
|
||||
}) inputs;
|
||||
|
||||
services.getty.greetingLine = ''<<< Welcome to Universe ${config.system.nixos.label} (\m) - \l >>>'';
|
||||
# Include some utilities that are useful for installing or repairing
|
||||
# the system.
|
||||
environment.systemPackages = [
|
||||
pkgs.w3m-nographics # needed for the manual anyway
|
||||
pkgs.testdisk # useful for repairing boot problems
|
||||
pkgs.ms-sys # for writing Microsoft boot sectors / MBRs
|
||||
pkgs.efibootmgr
|
||||
pkgs.efivar
|
||||
pkgs.parted
|
||||
pkgs.gptfdisk
|
||||
pkgs.ddrescue
|
||||
pkgs.ccrypt
|
||||
pkgs.cryptsetup # needed for dm-crypt volumes
|
||||
nix.nixPath = [ "/etc/nix/inputs" ];
|
||||
|
||||
# Some networking tools.
|
||||
pkgs.fuse
|
||||
pkgs.fuse3
|
||||
pkgs.sshfs-fuse
|
||||
pkgs.socat
|
||||
pkgs.screen
|
||||
pkgs.tcpdump
|
||||
|
||||
# Hardware-related tools.
|
||||
pkgs.sdparm
|
||||
pkgs.hdparm
|
||||
pkgs.smartmontools # for diagnosing hard disks
|
||||
pkgs.pciutils
|
||||
pkgs.usbutils
|
||||
pkgs.nvme-cli
|
||||
# Neverever change this value
|
||||
system.stateVersion = "24.05";
|
||||
|
||||
# Some compression/archiver tools.
|
||||
pkgs.unzip
|
||||
pkgs.zip
|
||||
services.getty.greetingLine = ''[Welcome to Universe ${config.system.nixos.label} (\m) - \l]'';
|
||||
# Include some utilities that are useful for installing or repairing
|
||||
# the system.
|
||||
environment.systemPackages = [
|
||||
pkgs.w3m-nographics # needed for the manual anyway
|
||||
pkgs.testdisk # useful for repairing boot problems
|
||||
pkgs.ms-sys # for writing Microsoft boot sectors / MBRs
|
||||
pkgs.efibootmgr
|
||||
pkgs.efivar
|
||||
pkgs.parted
|
||||
pkgs.gptfdisk
|
||||
pkgs.ddrescue
|
||||
pkgs.ccrypt
|
||||
pkgs.cryptsetup # needed for dm-crypt volumes
|
||||
|
||||
pkgs.wget
|
||||
pkgs.curl
|
||||
# Some networking tools.
|
||||
pkgs.fuse
|
||||
pkgs.fuse3
|
||||
pkgs.sshfs-fuse
|
||||
pkgs.socat
|
||||
pkgs.screen
|
||||
pkgs.tcpdump
|
||||
|
||||
pkgs.htop
|
||||
# Hardware-related tools.
|
||||
pkgs.sdparm
|
||||
pkgs.hdparm
|
||||
pkgs.smartmontools # for diagnosing hard disks
|
||||
pkgs.pciutils
|
||||
pkgs.usbutils
|
||||
pkgs.nvme-cli
|
||||
|
||||
pkgs.emacs
|
||||
];
|
||||
# Some compression/archiver tools.
|
||||
pkgs.unzip
|
||||
pkgs.zip
|
||||
|
||||
environment.variables.EDITOR = "emacs";
|
||||
pkgs.wget
|
||||
pkgs.curl
|
||||
|
||||
pkgs.htop
|
||||
|
||||
pkgs.emacs-nox
|
||||
universePkg
|
||||
];
|
||||
|
||||
|
||||
environment.variables.EDITOR = "emacs";
|
||||
|
||||
nix.settings = {
|
||||
experimental-features = lib.mkDefault "nix-command flakes";
|
||||
};
|
||||
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
console = {
|
||||
font = "Lat2-Terminus16";
|
||||
keyMap = lib.mkDefault "us";
|
||||
useXkbConfig = true; # use xkb.options in tty.
|
||||
};
|
||||
|
||||
# Include support for various filesystems and tools to create / manipulate them.
|
||||
boot.supportedFilesystems =
|
||||
[ "btrfs" "cifs" "f2fs" "vfat" "xfs" ];
|
||||
|
||||
|
||||
services.openssh.enable = true;
|
||||
|
||||
|
||||
programs.mtr.enable = true;
|
||||
programs.gnupg.agent = {
|
||||
enable = true;
|
||||
enableSSHSupport = true;
|
||||
};
|
||||
|
||||
nix.settings = {
|
||||
experimental-features = lib.mkDefault "nix-command flakes";
|
||||
};
|
||||
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
# Enter keyboard layout
|
||||
services.xserver.xkb.layout = "us";
|
||||
|
||||
# Include support for various filesystems and tools to create / manipulate them.
|
||||
boot.supportedFilesystems =
|
||||
[ "btrfs" "cifs" "f2fs" "vfat" "xfs" ];
|
||||
};
|
||||
|
||||
desktop = { pkgs, lib, inputs, ... }: {
|
||||
environment.noXlibs = lib.mkForce false;
|
||||
|
||||
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
xkb.layout = "us";
|
||||
xkb.options = "eurosign:e";
|
||||
|
||||
displayManager = {
|
||||
startx = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
libinput.enable = true; # for touchpad support
|
||||
videoDrivers = [
|
||||
"modesetting"
|
||||
|
@ -116,6 +148,7 @@ rec {
|
|||
|
||||
};
|
||||
|
||||
sound.enable = true;
|
||||
# Enable sound in virtualbox appliances.
|
||||
hardware.pulseaudio.enable = true;
|
||||
|
||||
|
@ -127,31 +160,16 @@ rec {
|
|||
|
||||
environment.systemPackages = [
|
||||
pkgs.glxinfo
|
||||
#inputs.fg42.packages.${params.system}.default
|
||||
];
|
||||
|
||||
networking.networkmanager.enable = true;
|
||||
};
|
||||
|
||||
zshModule = {config, pkgs, ...}: {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autosuggestions.enable = true;
|
||||
histSize = 5000;
|
||||
syntaxHighlighting.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
users = {config, pkgs, ...}: {
|
||||
|
||||
imports = [
|
||||
zshModule
|
||||
];
|
||||
|
||||
installerUser = {config, pkgs, ...}: {
|
||||
users = {
|
||||
users.lxsameer = {
|
||||
password = "123123";
|
||||
users.universe = {
|
||||
password = "universe";
|
||||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
|
@ -160,18 +178,50 @@ rec {
|
|||
};
|
||||
|
||||
nix.settings = {
|
||||
trusted-users = [ "root" "@wheel" "lxsameer" ];
|
||||
trusted-users = [ "root" "@wheel" "universe" ];
|
||||
};
|
||||
};
|
||||
|
||||
bootable = {lib, pkgs, ...}: {
|
||||
bootable = { lib, pkgs, ...}: {
|
||||
boot = {
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
loader = {
|
||||
generic-extlinux-compatible.enable = lib.mkDefault true;
|
||||
grub.enable = lib.mkDefault true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
disk = diskFile: grubPart: { lib, pkgs, ... }: {
|
||||
environment.systemPackages = [
|
||||
pkgs.disko
|
||||
];
|
||||
|
||||
environment.etc = {
|
||||
"disks.nix".source = diskFile;
|
||||
};
|
||||
|
||||
boot.loader.grub.device = grubPart;
|
||||
};
|
||||
|
||||
autoInstaller = host: partitioner: { lib, pkgs, ... }: {
|
||||
imports = [
|
||||
partitioner
|
||||
];
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeShellScriptBin "install-universe" ''
|
||||
# if /etc/universe_release
|
||||
export NIX_PATH=/etc/nix/inputs/
|
||||
echo "Partitioning the disk..."
|
||||
${pkgs.disko}/bin/disko -m disko /etc/disks.nix
|
||||
mkdir -p /mnt/etc/nix
|
||||
ln -s /mnt/etc/nix/inputs/ /etc/nix/inputs/
|
||||
cd /mnt
|
||||
echo "running installer"
|
||||
nixos-install --impure --flake self#${host} --root /mnt -v --show-trace
|
||||
echo "done"
|
||||
'')
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
default_user:
|
||||
user: ENC[AES256_GCM,data:tYLQFNvn15A=,iv:NkYD1q1IozC+UBjPG4BWEZ0troWVjGCW9hBCD8n/kk4=,tag:ZDltnGkxOl/VhF89MkR0PA==,type:str]
|
||||
pass: ENC[AES256_GCM,data:75vsOLMuq8wO,iv:tLUFa+yaa518QE1Thp3IQmDDXAp19A2kkm+uyI2twu0=,tag:nkrjmrxCQnZtkUE24uuLOA==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age150sgqcr35yfxypeyfz0f8yxxkcwy55j076qetjpd5zsxen9xnd9qum72py
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA1RFpUN1hVTzh3TFhPQXZz
|
||||
QmU0L203dVdZS0xJMXZJdlJIclpOQXFqZ0hvCmF0Vmc1anFUNENrVWNNK0FXajFn
|
||||
OG12NTlDdE1QNExsZHBBUXpBc2ZuSWMKLS0tIElKK3lsTjBGVEEySEc1Ym43d0Z4
|
||||
WnF5SDJwL2ZXUFBhQUlORGtGMEJ2NE0KMvwSaxIGRTHTP7QFz1ZXTs8IX+07KsUO
|
||||
aCJOFaFwA1Tpm4Dy1yPs2gg0GPU8MCFBJZNCqkcy6hUHTt5kAivxRg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-02-04T19:10:48Z"
|
||||
mac: ENC[AES256_GCM,data:xLei4WcDjOijVh+9dN1rab8Bgx6Q/SPwZsiskQvbstHKtIPlXahXyOd/qDRNtLn2Evql/+48qnnqXmetGsP2w/FNyQLkPrAS/fkXrVzRGh7xrda60aH/cemMlx2SdJzNrRM1JiGCzCn5HamrBzz+aj/t58qlbKizAB29LXZhMmQ=,iv:IFYgzybJyAJXzRDRu0PbnTHun/yyfloByLQEw9VeYjw=,tag:QiIhpEK2C+je0jlSC4ECbQ==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
|
@ -0,0 +1,58 @@
|
|||
# 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/>.
|
||||
params:
|
||||
rec {
|
||||
zshModule = {config, pkgs, ...}: {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autosuggestions.enable = true;
|
||||
histSize = 5000;
|
||||
syntaxHighlighting.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
user = {config, pkgs, inputs, ...}: {
|
||||
imports = [
|
||||
zshModule
|
||||
inputs.sops.nixosModules.sops
|
||||
];
|
||||
|
||||
sops.secrets.lxsameer-password = {
|
||||
sopsFile = ./secrets.yaml;
|
||||
format = "yaml";
|
||||
neededForUsers = true;
|
||||
key = "password";
|
||||
};
|
||||
|
||||
users = {
|
||||
users.lxsameer = {
|
||||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
];
|
||||
hashedPasswordFile = config.sops.secrets.lxsameer-password.path;
|
||||
};
|
||||
};
|
||||
|
||||
nix.settings = {
|
||||
trusted-users = [ "root" "@wheel" "lxsameer" ];
|
||||
};
|
||||
};
|
||||
|
||||
desktop = import ./desktop.nix;
|
||||
}
|
|
@ -242,7 +242,7 @@
|
|||
# You can update home Manager without changing this value. See
|
||||
# the home Manager release notes for a list of state version
|
||||
# changes in each release.
|
||||
home.stateVersion = "23.11";
|
||||
home.stateVersion = "24.05";
|
||||
|
||||
# Let home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
password: ENC[AES256_GCM,data:flsHnpYO1eR/,iv:sK9J4HFjtONX2YFXK4JnE2dfzKZti9SW380VgvnnJkA=,tag:0S146w5OYmIiUKNfBZxfTw==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age: []
|
||||
lastmodified: "2024-02-24T22:04:02Z"
|
||||
mac: ENC[AES256_GCM,data:tMpnNg2ff/kl3/Dav13APHnXoTOnFNOwv4VRHKt0MBanfp6zYGm964QEZMoSL3nt8iGRRqcPtLNyzZBRV3zj6tNnqUR16LPLQIvPtSOvhviuD7H4eszTGHDVRcZjUjpWEfa8LOFZS8gC/Y3x28lHXhluv0QDFViWERwiWhRKHpw=,iv:qfJns7JG3I9BUIiLIPksgA+p8AddGTP0UwSq28rb9mw=,tag:tJeKRqTqgCchJhiH0c4UrA==,type:str]
|
||||
pgp:
|
||||
- created_at: "2024-02-24T22:03:21Z"
|
||||
enc: |-
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
|
||||
hQIMA+z7k3suekM9ARAAya0Fxf48hGlZBu8hVggSPYQAZk0W8GTTvwTxcuFntgld
|
||||
doEAAKreQcvGrOuzrduqYl5jvHZgV96TitmUml9vNVZXNGzJe6hP4z5dwHwhP9lO
|
||||
Q33WSuobiqWCYM93vyCI3mPCnZtnu5l+LYRJ7nT6SK/rMt5aHdwtawbVGf4TvrUx
|
||||
LzBaURP0UDwxESzPOJgzlVP0b+b02hYSS1atnrDv8nQmBtnfFLQ77joTx7C7Bu8o
|
||||
29lC9C4/HOZhAiOhfqhWAeujparcVhhtLK1SVB3euceKZwLx7DW8KHSvtZ+xZC+K
|
||||
5FNoY4UYdHTHQEyhzytFXzFxsyhi2kmA0Gz5OCMepgCNLPjI1TCh9T7nXzsWn6dT
|
||||
ve3N45aR0KQIjZ5x7jiSa1K3ZOTgzQ5X3oNoAV6XB6b4LnnoDrPcRag6BEZl87iq
|
||||
gOt4s7TjcLQE9BkDqdLCiBTVY8YUd2X3sFsXKK4JrEWxzodUmEQ99k7febqou+1t
|
||||
FMvZyIAsq1JkBq3IN5Y7hwjf4zMGDy0e3O97FAy5xwPi4gNIw+IpYlzER9P0tJqi
|
||||
fRl7UzDxxbKP0JBa5yq93kxkB0OFFMsO7FHktRjOGOpL51u2g7k9speBTwS8L4Z9
|
||||
94DTXk2waSdRzscJ47S5VCi6+J+YG9qOzt6Q3+1fnGqZiaFBeFj4i/oxNTN37ZjS
|
||||
XgFbtlZPLmSaeJuqaJLX7UWwQM1BCS6A+V3peT2crhfuxSSlmJD4UlEbxVpkGPj+
|
||||
kOAnmS79osdXDY8O7LGKIeCLxzONcYRtmaMl8vNVFmx/0Ttdo68n2vmwVaTgoj8=
|
||||
=yO/t
|
||||
-----END PGP MESSAGE-----
|
||||
fp: 90F8357A163ACEAC21AE9E94ECFB937B2E7A433D
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
|
@ -13,21 +13,23 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
{ lib, stdenv, writeScriptBin, symlinkJoin }:
|
||||
{ lib, stdenv, writeScriptBin, symlinkJoin, libslirp, qemu }:
|
||||
rec {
|
||||
# Add a command to the shell to create the disk
|
||||
create-disk = writeScriptBin "create-disk" ''
|
||||
#!${stdenv.shell}
|
||||
|
||||
qemu-img create -f qcow2 vdisk1 10G
|
||||
qemu-img create -f qcow2 vdisk1 40G
|
||||
'';
|
||||
|
||||
bootImage = image: (writeScriptBin "boot-${image.name}" ''
|
||||
#!${stdenv.shell}
|
||||
|
||||
qemu-system-x86_64 -enable-kvm -m 2048 -boot d \
|
||||
SLIRP=yes ${qemu}/bin/qemu-system-x86_64 -enable-kvm -m 2048 -boot d \
|
||||
-cdrom ${image} -hda vdisk1 -vga std \
|
||||
-net user,hostfwd=tcp::2222-:22 -net nic
|
||||
-net user,hostfwd=tcp::10022-:22 \
|
||||
-netdev user,id=eth -device e1000,netdev=eth
|
||||
|
||||
'');
|
||||
|
||||
scripts = symlinkJoin {
|
||||
|
@ -37,4 +39,8 @@ rec {
|
|||
];
|
||||
};
|
||||
|
||||
sanitizeBuilderConfig = config: (with builtins;
|
||||
assert hasAttr "inVM" config;
|
||||
config
|
||||
);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
# 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/>.
|
||||
{ nixpkgs,
|
||||
modules,
|
||||
system,
|
||||
inputs,
|
||||
pkgs,
|
||||
utils,
|
||||
diskModule,
|
||||
host, # String
|
||||
hostBuilderConfig ? {
|
||||
inVM = false;
|
||||
},
|
||||
...
|
||||
}:
|
||||
|
||||
|
||||
let
|
||||
inVM = (utils.sanitizeBuilderConfig hostBuilderConfig).inVM;
|
||||
in nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
|
||||
|
||||
modules = (with modules; [
|
||||
"${nixpkgs}/nixos/modules/profiles/minimal.nix"
|
||||
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
|
||||
(_: {
|
||||
networking.hostName = "Universe";
|
||||
})
|
||||
bootable
|
||||
base
|
||||
installerUser
|
||||
generator
|
||||
(autoInstaller host diskModule)
|
||||
]);
|
||||
|
||||
# Pass these attributes to all the modules for this
|
||||
# host
|
||||
specialArgs = { inherit inputs hostBuilderConfig; };
|
||||
}
|
|
@ -13,45 +13,83 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
{ nixpkgs, mods, system, inputs, ... }:
|
||||
{ nixpkgs,
|
||||
modules,
|
||||
system,
|
||||
inputs,
|
||||
pkgs,
|
||||
utils,
|
||||
hostBuilderConfig ? {
|
||||
inVM = false;
|
||||
},
|
||||
...
|
||||
}@params:
|
||||
|
||||
|
||||
let
|
||||
this = { pkgs, config, lib, ... }: {
|
||||
time.timeZone = lib.mkDefault "Europe/Dublin";
|
||||
time.timeZone = lib.mkDefault "Europe/Dublin";
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
zsh
|
||||
fg42
|
||||
];
|
||||
networking.hostName = "majin";
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
|
||||
fileSystems."/" =
|
||||
if inVM
|
||||
then {
|
||||
device = "ata-QEMU_HARDDISK_QM00001-part2";
|
||||
fsType = "ext4";
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
fsType = "ext4";
|
||||
};
|
||||
};
|
||||
|
||||
lxsameer.desktop = import ../users/lxsameer/desktop.nix;
|
||||
lxsameer = pkgs.callPackage ../users/lxsameer/default.nix {};
|
||||
|
||||
fg42 = inputs.fg42.packages.${system}.default;
|
||||
inVM = (utils.sanitizeBuilderConfig hostBuilderConfig).inVM;
|
||||
|
||||
in nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
in {
|
||||
|
||||
modules = (with mods; [
|
||||
"${nixpkgs}/nixos/modules/profiles/minimal.nix"
|
||||
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
|
||||
bootable
|
||||
base
|
||||
users
|
||||
desktop
|
||||
generator
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
installer = import ./installer.nix (params // {
|
||||
host = if inVM then "majinVM" else "majin";
|
||||
diskModule = (modules.disk
|
||||
(if inVM then ./majin/vm.disk.nix else ./majin/disk.nix)
|
||||
(if inVM then "/dev/sda" else "/den/"));
|
||||
});
|
||||
|
||||
home-manager.users.lxsameer = lxsameer.desktop;
|
||||
home-manager.extraSpecialArgs = {
|
||||
inherit inputs fg42;
|
||||
};
|
||||
}
|
||||
]);
|
||||
majin = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = (with modules; [
|
||||
"${nixpkgs}/nixos/modules/profiles/minimal.nix"
|
||||
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
|
||||
this
|
||||
(disk
|
||||
(builtins.trace ">>>> ${toString inVM}" (if inVM then ./majin/vm.disk.nix else ./majin/disk.nix))
|
||||
(if inVM then "/dev/sda" else "/den/"))
|
||||
|
||||
bootable
|
||||
base
|
||||
lxsameer.user
|
||||
desktop
|
||||
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
|
||||
home-manager.users.lxsameer = lxsameer.desktop;
|
||||
home-manager.extraSpecialArgs = {
|
||||
inherit inputs fg42;
|
||||
};
|
||||
}
|
||||
]);
|
||||
|
||||
# Pass these attributes to all the modules for this
|
||||
# host
|
||||
specialArgs = { inherit inputs hostBuilderConfig; };
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
sda = {
|
||||
device = "/dev/sda";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
type = "EF00";
|
||||
size = "500M";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue