ldsalkjdsalkj

This commit is contained in:
Peder Bergebakken Sundt 2024-02-20 08:50:31 +01:00
parent 662eb9565c
commit 06efa74cbc
1 changed files with 29 additions and 48 deletions

View File

@ -1,20 +1,19 @@
{ {
description = "My visionfive 2 setup"; description = "My visionfive 2 setup";
#inputs.nixpkgs.url = "github:NickCao/nixpkgs/riscv"; # https://github.com/NickCao/nixpkgs/tree/riscv #inputs.nixpkgs.url = "github:NickCao/nixpkgs/riscv"; # https://github.com/NickCao/nixpkgs/tree/riscv
#inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; #inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.nixos-hardware.url = "github:nixos/nixos-hardware"; inputs.nixos-hardware.url = "github:nixos/nixos-hardware";
#inputs.nickcao-rv64.url = "github:NickCao/nixos-riscv"; # https://github.com/NickCao/nixos-riscv #inputs.nickcao-rv64.url = "github:NickCao/nixos-riscv"; # https://github.com/NickCao/nixos-riscv
#inputs.nickcao-rv64.inputs.nixpkgs.follows = "nixpkgs"; #inputs.nickcao-rv64.inputs.nixpkgs.follows = "nixpkgs";
#inputs.zhao-rv64.url = "github:zhaofengli/nixos-riscv64"; # https://github.com/zhaofengli/nixos-riscv64 #inputs.zhao-rv64.url = "github:zhaofengli/nixos-riscv64"; # https://github.com/zhaofengli/nixos-riscv64
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
nixos-hardware, nixos-hardware,
#nickcao-rv64,
...} @ inputs: ...} @ inputs:
let let
forSystems = systems: f: nixpkgs.lib.genAttrs systems (system: f rec { forSystems = systems: f: nixpkgs.lib.genAttrs systems (system: f rec {
@ -28,25 +27,18 @@
"aarch64-linux" "aarch64-linux"
"riscv64-linux" "riscv64-linux"
]; ];
#overlays = nixpkgs.lib.mapAttrsToList (name: val: val) self.overlays;
in { in {
inherit inputs; inherit inputs;
#hydraJobs = {}
#overlays = {
# nickcao = nickcao-rv64.overlay;
# #default = (final: prev: {});
#};
nixosModules = rec { nixosModules = rec {
# cross # helper, ensures cross
rv64-maybe-cross = { config, lib, ... }: lib.mkIf (config.nixpkgs.system != "riscv64-linux") { rv64-maybe-cross = { config, lib, ... }: lib.mkIf (config.nixpkgs.system != "riscv64-linux") {
# (system != "riscv64-linux") => do cross # (system != "riscv64-linux") => do cross
nixpkgs.crossSystem.config = "riscv64-unknown-linux-gnu"; nixpkgs.crossSystem.config = "riscv64-unknown-linux-gnu";
nixpkgs.crossSystem.system = "riscv64-linux"; nixpkgs.crossSystem.system = "riscv64-linux";
}; };
# hardware # hardware, pick one
vf2-r12a = { lib, ...}: { vf2-r12a = { lib, ...}: {
imports = [ rv64-maybe-cross ]; imports = [ rv64-maybe-cross ];
hardware.deviceTree.name = "starfive/jh7110-starfive-visionfive-2-v1.2a.dtb"; hardware.deviceTree.name = "starfive/jh7110-starfive-visionfive-2-v1.2a.dtb";
@ -55,7 +47,7 @@
imports = [ vf2-r12a ]; imports = [ vf2-r12a ];
hardware.deviceTree.overlays = [{ hardware.deviceTree.overlays = [{
name = "8GB-patch"; name = "8GB-patch";
dtsFile = "${nixos-hardware}/starfive/visionfive/v2/visionfive-2-v1.2a-8GB.dts"; dtsFile = "${nixos-hardware}/starfive/visionfive/v2/8gb-patch.dts";
}]; }];
}; };
vf2-r13b = { lib, ...}: { vf2-r13b = { lib, ...}: {
@ -66,11 +58,11 @@
imports = [ vf2-r13b ]; imports = [ vf2-r13b ];
hardware.deviceTree.overlays = [{ hardware.deviceTree.overlays = [{
name = "8GB-patch"; name = "8GB-patch";
dtsFile = "${nixos-hardware}/starfive/visionfive/v2/visionfive-2-v1.3b-8GB.dts"; dtsFile = "${nixos-hardware}/starfive/visionfive/v2/8gb-patch.dts";
}]; }];
}; };
# install method # install method, pick one
vf2-qemu = { lib, ...}: { vf2-qemu = { lib, ...}: {
imports = [ "${nixos-hardware}/starfive/visionfive/v2" ./qemu-vm.nix ]; imports = [ "${nixos-hardware}/starfive/visionfive/v2" ./qemu-vm.nix ];
}; };
@ -117,9 +109,12 @@
imports = [ vf2-nvme ./efi-image.nix ]; imports = [ vf2-nvme ./efi-image.nix ];
}; };
# components # components
minimal = { lib, ...}: with lib; { dhcp = {
networking.interfaces.end0.useDHCP = true;
networking.interfaces.end1.useDHCP = true;
};
minimal = { lib, ...}: let inherit (lib) mkDefault mkForce; in {
#boot.enableContainers = mkDefault false; #boot.enableContainers = mkDefault false;
documentation.enable = mkDefault false; documentation.enable = mkDefault false;
documentation.doc.enable = mkDefault false; documentation.doc.enable = mkDefault false;
@ -127,10 +122,10 @@
documentation.man.enable = mkDefault false; documentation.man.enable = mkDefault false;
documentation.nixos.enable = mkDefault false; documentation.nixos.enable = mkDefault false;
#environment.noXlibs = mkDefault true; #environment.noXlibs = mkDefault true;
networking.firewall.enable = lib.mkDefault false; networking.firewall.enable = mkDefault false;
programs.command-not-found.enable = false; programs.command-not-found.enable = false;
security.audit.enable = mkDefault false; security.audit.enable = mkDefault false;
security.polkit.enable = lib.mkForce false; security.polkit.enable = mkForce false;
services.logrotate.enable = mkDefault false; services.logrotate.enable = mkDefault false;
services.udisks2.enable = mkDefault false; services.udisks2.enable = mkDefault false;
#xdg.autostart.enable = mkDefault false; #xdg.autostart.enable = mkDefault false;
@ -138,39 +133,27 @@
#xdg.mime.enable = mkDefault false; #xdg.mime.enable = mkDefault false;
#xdg.sounds.enable = mkDefault false; #xdg.sounds.enable = mkDefault false;
}; };
dhcp = {
networking.interfaces.end0.useDHCP = true; # hosts
networking.interfaces.end1.useDHCP = true; demo = { pkgs, ... }: {
imports = [ minimal dhcp "${nixpkgs}/nixos/modules/profiles/base.nix" ];
networking.hostName = "demo";
environment.systemPackages = with pkgs;[ neofetch htop fd ripgrep ];
system.stateVersion = "23.11";
};
asgaut = { pkgs, ... }: {
imports = [ minimal dhcp ];
networking.hostName = "asgaut";
networking.domain = "pbsds.net"; networking.domain = "pbsds.net";
networking.search = [ "pbsds.net" ]; networking.search = [ "pbsds.net" ];
};
locale-no_nb = {
console.keyMap = "no"; console.keyMap = "no";
services.xserver.layout = "no"; services.xserver.layout = "no";
services.xserver.xkbVariant = ""; services.xserver.xkbVariant = "";
time.timeZone = "Europe/Oslo"; time.timeZone = "Europe/Oslo";
i18n.defaultLocale = "en_US.utf8"; i18n.defaultLocale = "en_US.utf8";
i18n.extraLocaleSettings.LC_TIME = "nb_NO.utf8"; i18n.extraLocaleSettings.LC_TIME = "nb_NO.utf8";
};
# hosts
demo = { pkgs, ... }: {
imports = [ minimal dhcp "${nixpkgs}/nixos/modules/profiles/base.nix" ];
networking.hostName = "demo";
system.stateVersion = "23.05";
};
asgaut = { pkgs, ... }: {
imports = [ minimal dhcp locale-no_nb ];
networking.hostName = "asgaut";
environment.systemPackages = with pkgs;[ neofetch htop fd ripgrep ]; environment.systemPackages = with pkgs;[ neofetch htop fd ripgrep ];
system.stateVersion = "23.05"; system.stateVersion = "23.11";
virtualisation.docker.enable = true;
};
gunder = { pkgs, ... }: {
imports = [ minimal dhcp locale-no_nb ];
networking.hostName = "gunder";
environment.systemPackages = with pkgs;[ neofetch htop fd ripgrep ];
system.stateVersion = "23.05";
}; };
}; };
@ -188,7 +171,6 @@
// (mkAll "demo-r13b" [ m.demo m.vf2-r13b ]) // (mkAll "demo-r13b" [ m.demo m.vf2-r13b ])
// (mkAll "demo-r13b-8gb" [ m.demo m.vf2-r13b-8gb ]) // (mkAll "demo-r13b-8gb" [ m.demo m.vf2-r13b-8gb ])
// (mkAll "asgaut" [ m.asgaut m.vf2-r12a-8gb ]) // (mkAll "asgaut" [ m.asgaut m.vf2-r12a-8gb ])
// (mkAll "gunder" [ m.gunder m.vf2-r12a-8gb ])
// { // {
default = self.packages.${system}.demo-r12a-qemu; default = self.packages.${system}.demo-r12a-qemu;
}); });
@ -198,7 +180,6 @@
mkSystem = modules: nixpkgs.lib.nixosSystem { system = "x86_64-linux"; inherit modules; }; mkSystem = modules: nixpkgs.lib.nixosSystem { system = "x86_64-linux"; inherit modules; };
in { in {
asgaut = mkSystem (with m; [ asgaut vf2-r12a-8gb vf2-nvme ]); asgaut = mkSystem (with m; [ asgaut vf2-r12a-8gb vf2-nvme ]);
gunder = mkSystem (with m; [ gunder vf2-r12a-8gb vf2-nvme ]);
}; };
}; };
} }