init
This commit is contained in:
commit
57fa994768
9 changed files with 311 additions and 0 deletions
18
boot.nix
Normal file
18
boot.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ config, pkgs, ... }: {
|
||||
boot = {
|
||||
loader = {
|
||||
grub.enable = false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
};
|
||||
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
fsType = "tmpfs";
|
||||
neededForBoot = true;
|
||||
options = [ "mode=755" ];
|
||||
};
|
||||
};
|
||||
}
|
19
builder.nix
Normal file
19
builder.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
nix = {
|
||||
settings = {
|
||||
builders-use-substitutes = true;
|
||||
};
|
||||
|
||||
distributedBuilds = true;
|
||||
buildMachines = [ {
|
||||
hostName = "192.168.2.1";
|
||||
systems = [ "x86_64-linux" ];
|
||||
protocol = "ssh-ng";
|
||||
supportedFeatures = [ "big-parallel" "kvm" "nixos-test" "benchmark" ];
|
||||
speedFactor = 100;
|
||||
maxJobs = 16;
|
||||
sshUser = "nix-remote-build";
|
||||
sshKey = "/root/.ssh/id_build_server";
|
||||
} ];
|
||||
};
|
||||
}
|
18
cpu.nix
Normal file
18
cpu.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
nixpkgs.overlays = [(final: prev: {
|
||||
stdenv = let
|
||||
adapt = prev.stdenvAdapters;
|
||||
unhardened = adapt.withDefaultHardeningFlags [] prev.stdenv;
|
||||
#withflags = adapt.withCFlags [ "-misa-spec=2.2" ] unhardened;
|
||||
in unhardened;
|
||||
})];
|
||||
|
||||
nixpkgs.buildPlatform.system = "x86_64-linux";
|
||||
|
||||
nixpkgs.config.hostSystem = let
|
||||
arch = "rv64imafdcv_zicbom_zicbob_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zfhmin_zkt_zba_zbb_zbc_zbs_zbkc_zvfh_zvfhmin_zvkt";
|
||||
in {
|
||||
gcc.arch = arch;
|
||||
system = "riscv64-unknown-linux-lp64d";
|
||||
};
|
||||
}
|
26
flake.lock
generated
Normal file
26
flake.lock
generated
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1744932701,
|
||||
"narHash": "sha256-fusHbZCyv126cyArUwwKrLdCkgVAIaa/fQJYFlCEqiU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
38
flake.nix
Normal file
38
flake.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = inputs @ { self, nixpkgs, ... }: {
|
||||
nixosConfigurations = {
|
||||
jupiter = nixpkgs.lib.nixosSystem rec {
|
||||
system = "riscv64-linux";
|
||||
specialArgs = {
|
||||
inherit self system inputs;
|
||||
boot = self.packages.x86_64-linux.boot.entries;
|
||||
};
|
||||
|
||||
modules = [
|
||||
./cpu.nix
|
||||
./nixpkgs.nix
|
||||
./builder.nix
|
||||
./system.nix
|
||||
./boot.nix
|
||||
|
||||
./ghc.nix
|
||||
./riscvfixes.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
packages = {
|
||||
x86_64-linux = let
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in {
|
||||
boot = pkgs.linkFarm "boot" {
|
||||
"ghc-9.4.8" = pkgs.pkgsCross.riscv64.haskell.compiler.native-bignum.ghc948;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
101
ghc.nix
Normal file
101
ghc.nix
Normal file
|
@ -0,0 +1,101 @@
|
|||
# https://github.com/AlexandreTunstall/nixos-riscv/blob/master/modules/compilers/ghc.nix
|
||||
{ boot, lib, ... }:
|
||||
|
||||
{
|
||||
nixpkgs.overlays = lib.mkBefore [
|
||||
(self: super: let
|
||||
mkBootCompiler = { drv, llvmPackages }: drv.overrideAttrs ({ passthru ? {}, ... }: {
|
||||
passthru = passthru // {
|
||||
inherit llvmPackages;
|
||||
};
|
||||
});
|
||||
|
||||
mkBootPackages = { base, ghc }: let
|
||||
buildHaskellPackages = base.override (old: {
|
||||
inherit buildHaskellPackages ghc;
|
||||
|
||||
overrides = bootOverrides;
|
||||
});
|
||||
in buildHaskellPackages;
|
||||
|
||||
hsLib = self.haskell.lib.compose;
|
||||
|
||||
bootOverrides = self: super: {
|
||||
mkDerivation = args: super.mkDerivation ({
|
||||
enableLibraryProfiling = false;
|
||||
} // args);
|
||||
|
||||
alex = hsLib.dontCheck super.alex;
|
||||
data-array-byte = hsLib.dontCheck super.data-array-byte;
|
||||
doctest = hsLib.dontCheck super.doctest;
|
||||
extra = hsLib.dontCheck super.extra;
|
||||
hashable = hsLib.dontCheck super.hashable;
|
||||
optparse-applicative = hsLib.dontCheck super.optparse-applicative;
|
||||
QuickCheck = hsLib.dontCheck super.QuickCheck;
|
||||
temporary = hsLib.dontCheck super.temporary;
|
||||
unordered-containers = hsLib.dontCheck super.unordered-containers;
|
||||
vector = hsLib.dontCheck super.vector;
|
||||
};
|
||||
|
||||
# There is no neater way of overriding Hadrian
|
||||
withPatchedHadrian = ghc: ghc.override {
|
||||
hadrian = hsLib.disableCabalFlag "threaded" (hsLib.appendPatches [
|
||||
(self.fetchpatch {
|
||||
name = "enable-ghci.patch";
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/dd38aca95ac25adc9888083669b32ff551151259.patch";
|
||||
hash = "sha256-xqs6mw/akxMy+XmVabACzsIviIKP4fS0UEgTk0HJcIc=";
|
||||
stripLen = 1;
|
||||
})
|
||||
] ghc.hadrian);
|
||||
};
|
||||
|
||||
overrides = self: super: {
|
||||
# Profiling is disabled for GHC on RISC-V due to size constraints
|
||||
mkDerivation = args: super.mkDerivation ({
|
||||
enableLibraryProfiling = false;
|
||||
} // args);
|
||||
|
||||
# LLVM segfaults in one of the happy tests
|
||||
happy = hsLib.dontCheck super.happy;
|
||||
};
|
||||
|
||||
in {
|
||||
haskell = super.haskell // {
|
||||
compiler = {
|
||||
ghc948Boot = mkBootCompiler {
|
||||
drv = boot."ghc-9.4.8";
|
||||
llvmPackages = self.llvmPackages_15;
|
||||
};
|
||||
|
||||
ghc966 = (withPatchedHadrian (super.haskell.compiler.ghc966.override {
|
||||
bootPkgs = self.haskell.packages.ghc948Boot;
|
||||
llvmPackages = self.llvmPackages_15;
|
||||
})).overrideAttrs ({ patches ? [], ... }: {
|
||||
patches = patches ++ [
|
||||
(self.fetchpatch {
|
||||
name = "enable-ghci-hadrian.patch";
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/c5e47441ab2ee2568b5a913ce75809644ba83271.patch";
|
||||
hash = "sha256-t3KkuME6IqLWuESIMZ7OVAFu7s8G+x0ev+aVzBUqkhg=";
|
||||
})
|
||||
];
|
||||
});
|
||||
|
||||
ghc96 = self.haskell.compiler.ghc966;
|
||||
};
|
||||
|
||||
packages = {
|
||||
inherit (super.haskell.packages) ghc96;
|
||||
|
||||
ghc966 = super.haskell.packages.ghc966.override {
|
||||
inherit overrides;
|
||||
};
|
||||
|
||||
ghc948Boot = mkBootPackages {
|
||||
base = super.haskell.packages.ghc948;
|
||||
ghc = self.pkgsBuildHost.haskell.compiler.ghc948Boot;
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
20
nixpkgs.nix
Normal file
20
nixpkgs.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ inputs, ... }: {
|
||||
nix = {
|
||||
settings = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
auto-optimise-store = true;
|
||||
};
|
||||
|
||||
registry = {
|
||||
nixpkgs.flake = inputs.nixpkgs;
|
||||
};
|
||||
|
||||
nixPath = [
|
||||
"nixpkgs=/etc/nix/inputs/nixpkgs"
|
||||
];
|
||||
};
|
||||
|
||||
environment.etc = {
|
||||
"nix/inputs/nixpkgs".source = inputs.nixpkgs.outPath;
|
||||
};
|
||||
}
|
51
riscvfixes.nix
Normal file
51
riscvfixes.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
nixpkgs.overlays = [(
|
||||
self: super: let
|
||||
dontCheck = drv: drv.overrideAttrs (old: {
|
||||
doCheck = false;
|
||||
});
|
||||
|
||||
pyDontCheck = drv: drv.overridePythonAttrs (old: {
|
||||
doCheck = false;
|
||||
});
|
||||
|
||||
hsLib = self.haskell.lib.compose;
|
||||
|
||||
in {
|
||||
haskell = super.haskell // {
|
||||
packages = super.haskell.packages // {
|
||||
ghc964 = super.haskell.packages.ghc964.override {
|
||||
overrides = hsSelf: hsSuper: {
|
||||
# enableSeparateBinOutput causes cyclic references in build outputs
|
||||
mkDerivation = self.lib.makeOverridable (args: hsSuper.mkDerivation (args // {
|
||||
enableSeparateBinOutput = false;
|
||||
}));
|
||||
# Tests fail
|
||||
happy = hsLib.dontCheck hsSuper.happy;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
libbsd = dontCheck super.libbsd;
|
||||
libuv = dontCheck super.libuv;
|
||||
|
||||
# Fails in ./configure when LuaJIT isn't available
|
||||
neovim-unwrapped = super.neovim-unwrapped.overrideAttrs ({ preConfigure ? "", ... }: {
|
||||
preConfigure = ''
|
||||
${preConfigure}
|
||||
cmakeFlagsArray+=( -DPREFER_LUA=ON )
|
||||
'';
|
||||
});
|
||||
|
||||
pixman = dontCheck super.pixman;
|
||||
protobuf = dontCheck super.protobuf;
|
||||
|
||||
pythonPackagesExtensions = super.pythonPackagesExtensions ++ [
|
||||
(pySelf: pySuper: {
|
||||
sphinx = pyDontCheck pySuper.sphinx;
|
||||
})
|
||||
];
|
||||
}
|
||||
)];
|
||||
}
|
20
system.nix
Normal file
20
system.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ pkgs, ... }: {
|
||||
networking.hostName = "jupiter";
|
||||
system.stateVersion = "25.04";
|
||||
time.timeZone = "America/Vancouver";
|
||||
|
||||
environment.systemPackages = builtins.attrValues {
|
||||
inherit (pkgs) vim;
|
||||
};
|
||||
|
||||
users.users = {
|
||||
admin = {
|
||||
isNormalUser = true;
|
||||
uid = 1000;
|
||||
extraGroups = [ "wheel" ];
|
||||
initialPassword = "test";
|
||||
};
|
||||
};
|
||||
|
||||
security.rtkit.enable = true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue