initial import

This commit is contained in:
Ari Gato 2024-07-05 13:12:43 +02:00
commit b13b8ad888
5 changed files with 183 additions and 0 deletions

61
configuration/minixos.nix Normal file
View file

@ -0,0 +1,61 @@
{ pkgs, lib, ... }:
{
boot.loader.grub.enable = false; # fails to build
boot.loader.systemd-boot.enable = true;
networking.useNetworkd = true; # dhcpcd crashes
environment.variables.LD_PRELOAD = "${pkgs.mimalloc}/lib/libmimalloc.so";
# normal setup stuff
boot.initrd.systemd.enable = true;
boot.initrd.systemd.emergencyAccess = true;
networking.nftables.enable = true;
services.getty.autologinUser = "musl";
security.sudo.wheelNeedsPassword = false;
users.users.musl = {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
documentation = {
enable = lib.mkForce false;
} // builtins.listToAttrs (map (x: {
name = x;
value = { enable = lib.mkForce false; };
}) [ "man" "info" "nixos" "doc" "dev" ]);
environment.noXlibs = true;
environment.systemPackages = lib.mkForce (with pkgs;
[
# strictly required
coreutils
nix
systemd
# shell's required and not automatically pulled in
bashInteractive
# avoid warnings
gnugrep
# nice-to-haves
procps
openssh
findutils
iproute2
util-linux
usbutils
neovim
tmux
]);
fileSystems = {
"/" = {
label = "NIXOS_ROOT";
fsType = "xfs";
};
};
}

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1719918800,
"narHash": "sha256-9UoMK9d1PiJZJrInbMONscA7QN8C6kZIX9FUyHp6UqQ=",
"owner": "arachnist",
"repo": "nixpkgs",
"rev": "02e10f7e99522cef9909f78312ffbbd2d96e59c3",
"type": "github"
},
"original": {
"owner": "arachnist",
"ref": "ar-patchset-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

38
flake.nix Normal file
View file

@ -0,0 +1,38 @@
{
description = "nixos musl experiments";
inputs = {
nixpkgs.url = "github:arachnist/nixpkgs?ref=ar-patchset-unstable";
};
outputs = { self, nixpkgs, ... }@inputs:
let
lib = nixpkgs.lib;
forAllSystems = f:
lib.genAttrs lib.systems.flakeExposed (system: f system);
in {
overlay = import ./overlay.nix;
legacyPackages = forAllSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
};
in pkgs.pkgsMusl);
nixosConfigurations.minixos = lib.nixosSystem {
modules = [
./nixos-fixes.nix
./configuration/minixos.nix
{
nixpkgs.hostPlatform = {
system = "x86_64-linux";
config = "x86_64-unknown-linux-musl";
};
}
];
};
};
}

42
nixos-fixes.nix Normal file
View file

@ -0,0 +1,42 @@
{ config, pkgs, lib, modulesPath, ... }:
{
disabledModules = [
# tries to instantiate 32-bit pkgs
(modulesPath + "/config/ldso.nix")
(modulesPath + "/programs/nix-ld.nix")
(modulesPath + "/config/stub-ld.nix")
];
config = lib.mkMerge [
(lib.mkIf config.nixpkgs.buildPlatform.isMusl {
nixpkgs.overlays = [ (import ./overlay.nix) ];
})
(lib.mkIf config.nixpkgs.hostPlatform.isMusl {
programs.steam.enable = lib.mkForce false;
services.pipewire.alsa.support32Bit = lib.mkForce false;
programs.mosh.withUtempter = lib.mkForce false;
programs.tmux.withUtempter = lib.mkForce false;
networking.nftables.checkRuleset = false; # lkl is broken :/
services.nscd.enable = false;
system.nssModules = lib.mkForce [ ];
i18n.glibcLocales = pkgs.callPackage
(pkgs.path + "/pkgs/development/libraries/glibc/locales.nix") {
allLocales = false;
};
security.pam.services.login.updateWtmp =
lib.mkForce false; # fixes pam errors
# service fails to start otherwise "Function not implemented"
systemd.services.nix-daemon.serviceConfig = {
CPUSchedulingPolicy = lib.mkForce null;
IOSchedulingClass = lib.mkForce null;
IOSchedulingPriority = lib.mkForce null;
};
})
];
}

15
overlay.nix Normal file
View file

@ -0,0 +1,15 @@
final: prev: {
python3 = prev.python3.override {
packageOverrides = python-final: python-prev: {
twisted = python-prev.twisted.overrideAttrs
(oldAttrs: { doInstallCheck = false; });
pandas = python-prev.pandas.overrideAttrs (oldAttrs: {
disabledTests = [
"test_can_set_locale_invalid_set"
"test_parsing_tzlocal_deprecated"
];
});
};
};
python3Packages = final.python3.pkgs;
}