cross-platform failing

pull/7/head
Pegasust 2023-01-19 07:28:54 -08:00
parent d4f6cf27a9
commit ca63340a3e
7 changed files with 109 additions and 98 deletions

View File

@ -117,11 +117,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1673737886,
"narHash": "sha256-hNTqD0uIgpbtTI2Nuj/Q1lEFOOdZqqXpxoc8rMno2F0=",
"lastModified": 1673948101,
"narHash": "sha256-cD0OzFfnLFeeaz4jVszH9QiMTn+PBxmcYzrp+xujpwM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "2827b5306462d91edec16a3d069b2d6e54c3079f",
"rev": "bd3efacb82c721edad1ce9eda583df5fb62ab00a",
"type": "github"
},
"original": {
@ -156,11 +156,11 @@
},
"locked": {
"dir": "contrib",
"lastModified": 1673746461,
"narHash": "sha256-Y21pbVNlPWPokXFbngSahnxeCff0LX+LKdDktEBIVm4=",
"lastModified": 1673937267,
"narHash": "sha256-zixnItZtMZRKK0bEh8UOBeh8JT4jeMzPR2TtacfXmyE=",
"owner": "neovim",
"repo": "neovim",
"rev": "6134c1e8a39a5e61d0593613343a5923a86e3545",
"rev": "2093e574c6c934a718f96d0a173aa965d3958a8b",
"type": "github"
},
"original": {
@ -177,11 +177,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1673770422,
"narHash": "sha256-hYVEUzvqobxAM2FZfWTrTLKKNfkOSfsm0uGqNoSiIvw=",
"lastModified": 1673943288,
"narHash": "sha256-TDo9wDfZH+MJ/tTeCtZ67jdHqtVvIxetLpFN9+vqZ7g=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "fd8e5953cfeada345d7daeedce6ab0919f1284d4",
"rev": "3c0bb335936754a2683a84ddf081594ddb567a89",
"type": "github"
},
"original": {
@ -226,6 +226,21 @@
"type": "path"
}
},
"nixlib": {
"locked": {
"lastModified": 1673743903,
"narHash": "sha256-sloY6KYyVOozJ1CkbgJPpZ99TKIjIvM+04V48C04sMQ=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "7555e2dfcbac1533f047021f1744ac8871150f9f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1671983799,
@ -298,6 +313,7 @@
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nix-index-database": "nix-index-database",
"nixgl": "nixgl",
"nixlib": "nixlib",
"nixpkgs": "nixpkgs_3",
"rust-overlay": "rust-overlay"
}
@ -308,11 +324,11 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1673749717,
"narHash": "sha256-hgrw8w/AThRWfVafx3EO3/TQlGcUou4nui8X47cVhXo=",
"lastModified": 1673922364,
"narHash": "sha256-U0XIY/Y/x4fFtlCZKMtWlqOYUnLiXj4F42GQHxWuPow=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "aab6eb2dfc7a1e42d94b6f24ef13639ff8544af4",
"rev": "4e0f9b8a5102387f8d19901bced16a256a6ccdc7",
"type": "github"
},
"original": {

View File

@ -1,10 +1,15 @@
{
nixConfig = {
accept-flake-config = true;
experimental-features = "nix-command flakes";
# for darwin's browser
allowUnsupportedSystem = true;
};
description = "My personal configuration in Nix (and some native configurations)";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
# continously merged & rebased lightweight .lib. Basically a huge extension to c_.
nixlib.url = "github:nix-community/nixpkgs.lib";
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
@ -45,8 +50,16 @@
, flake-compat
, neovim-nightly-overlay
, nix-index-database
, nixlib
, ...
}@_inputs:
let
# config_fn:: system -> config
# this function should take simple exports of homeConfigurations.${profile},
# nixosConfigurations.${profile}, devShells.${profile}, packages.${profile}
# and correctly produce
cross_platform = config_fn: (config_fn "x86_64-linux");
in cross_platform (system:
let
# Context/global stuffs to be passed down
# NOTE: this will only read files that are within git tree
@ -65,17 +78,9 @@
hosts.path = "${path}/hosts";
users.path = "${path}/users";
};
# TODO: adapt to different platforms think about different systems later
system = "x86_64-linux";
overlays = [
rust-overlay.overlays.default
(self: pkgs@{ lib, ... }: {
lib = pkgs.lib // (import ./lib (_inputs // { inherit pkgs proj_root; }));
})
];
pkgs = import nixpkgs {
inherit system;
overlays = import ./overlays.nix _inputs;
overlays = import ./overlays.nix (_inputs // {inherit system;});
config = {
allowUnfree = true;
};
@ -86,7 +91,7 @@
nixpkgs.lib
pkgs.lib
(import ./lib {
inherit proj_root pkgs overlays system;
inherit proj_root pkgs system;
inherit (pkgs) lib;
})
]);
@ -121,7 +126,7 @@
inherit (hosts) nixosConfigurations;
inherit (users) homeConfigurations;
inherit lib proj_root;
devShell."${system}" = import ./dev-shell.nix final_inputs;
devShells = import ./dev-shell.nix final_inputs;
templates = import ./templates final_inputs;
secrets = {
pubKeys = {
@ -130,10 +135,10 @@
};
};
unit_tests = lib.runTests unit_tests;
# unit_tests = lib.runTests unit_tests;
debug = {
inherit final_inputs hosts users modules lib inputs_w_lib unit_tests pkgs nixpkgs;
inherit final_inputs hosts users modules lib inputs_w_lib unit_tests pkgs nixpkgs nixlib;
};
formatter."${system}" = pkgs.nixpkgs-fmt;
};
});
}

View File

@ -34,25 +34,6 @@
in
"${mount_dest} ${confToBackendArg backend_args} :${s3fs-exec}\#${bucket}";
personalStorage = [
# hungtr-hot @ phoenix is broken :)
# (autofs-s3fs_entry {
# mount_dest = "hot";
# backend_args = {
# "-fstype" = "fuse";
# use_cache = "/tmp";
# del_cache = null;
# allow_other = null;
# url = ''"https://f5i0.ph.idrivee2-32.com"'';
# # TODO: builtins.readFile requires a Git-controlled file
# passwd_file = config.age.secrets.s3fs.path;
# dbglevel = "debug"; # enable this for better debugging info in journalctl
# uid = "1000"; # default user
# gid = "100"; # users
# umask="003"; # others read only, fully shared for users group
# # _netdev = null; # ignored by s3fs (https://github.com/s3fs-fuse/s3fs-fuse/blob/master/src/s3fs.cpp#L4910)
# };
# bucket = "hungtr-hot";
# })
(autofs-s3fs_entry {
mount_dest = "garden";
backend_args = {

View File

@ -1,12 +1,11 @@
# We use top-level nix-flake, so default.nix is basically just a wrapper around ./flake.nix
(import
(
# Get corresponding version of flake-compat declared in on ./flake.lock
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
c_ = import ./../../c_.nix {src = ./.;};
in
c_.fetchTree lock.nodes.flake-compat.locked
)
{ src = ./.; } # calls flake.nix
{ src = ./.; }
).defaultNix

View File

@ -97,11 +97,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1673737886,
"narHash": "sha256-hNTqD0uIgpbtTI2Nuj/Q1lEFOOdZqqXpxoc8rMno2F0=",
"lastModified": 1673948101,
"narHash": "sha256-cD0OzFfnLFeeaz4jVszH9QiMTn+PBxmcYzrp+xujpwM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "2827b5306462d91edec16a3d069b2d6e54c3079f",
"rev": "bd3efacb82c721edad1ce9eda583df5fb62ab00a",
"type": "github"
},
"original": {
@ -136,11 +136,11 @@
},
"locked": {
"dir": "contrib",
"lastModified": 1673746461,
"narHash": "sha256-Y21pbVNlPWPokXFbngSahnxeCff0LX+LKdDktEBIVm4=",
"lastModified": 1673937267,
"narHash": "sha256-zixnItZtMZRKK0bEh8UOBeh8JT4jeMzPR2TtacfXmyE=",
"owner": "neovim",
"repo": "neovim",
"rev": "6134c1e8a39a5e61d0593613343a5923a86e3545",
"rev": "2093e574c6c934a718f96d0a173aa965d3958a8b",
"type": "github"
},
"original": {
@ -157,11 +157,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1673770422,
"narHash": "sha256-hYVEUzvqobxAM2FZfWTrTLKKNfkOSfsm0uGqNoSiIvw=",
"lastModified": 1673943288,
"narHash": "sha256-TDo9wDfZH+MJ/tTeCtZ67jdHqtVvIxetLpFN9+vqZ7g=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "fd8e5953cfeada345d7daeedce6ab0919f1284d4",
"rev": "3c0bb335936754a2683a84ddf081594ddb567a89",
"type": "github"
},
"original": {
@ -239,11 +239,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1673631141,
"narHash": "sha256-AprpYQ5JvLS4wQG/ghm2UriZ9QZXvAwh1HlgA/6ZEVQ=",
"lastModified": 1673796341,
"narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "befc83905c965adfd33e5cae49acb0351f6e0404",
"rev": "6dccdc458512abce8d19f74195bb20fdb067df50",
"type": "github"
},
"original": {
@ -288,11 +288,11 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1673749717,
"narHash": "sha256-hgrw8w/AThRWfVafx3EO3/TQlGcUou4nui8X47cVhXo=",
"lastModified": 1673922364,
"narHash": "sha256-U0XIY/Y/x4fFtlCZKMtWlqOYUnLiXj4F42GQHxWuPow=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "aab6eb2dfc7a1e42d94b6f24ef13639ff8544af4",
"rev": "4e0f9b8a5102387f8d19901bced16a256a6ccdc7",
"type": "github"
},
"original": {

View File

@ -56,7 +56,7 @@
in
cross_platform (system:
let
overlays = import ./../../overlays.nix flake_inputs;
overlays = import ./../../overlays.nix (flake_inputs // {inherit system;});
# pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays;
pkgs = import nixpkgs {
inherit system overlays;
@ -131,6 +131,7 @@
};
};
};
# Personal darwin, effectively serves as the Darwin edge channel
"hungtran" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = base.modules ++ [
@ -140,10 +141,14 @@
# don't want to deal with GL stuffs on mac yet :/
base.graphics.useNixGL.defaultPackage = null;
# NOTE: this actually does not exist
base.keepass.path = "/Users/htran/keepass.kdbx";
base.keepass.path = "/Users/hungtran/keepass.kdbx";
base.alacritty.font.size = 11.0;
}
nerd_font_module
./base/productive_desktop.nix
{
base.private_chromium.enable = false;
}
];
extraSpecialArgs = mkModuleArgs {
inherit pkgs;
@ -153,6 +158,7 @@
};
};
};
# Work darwin
"htran" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = base.modules ++ [

View File

@ -1,13 +1,27 @@
flake_input@{ kpcli-py, nixgl, rust-overlay, neovim-nightly-overlay, ... }: [
flake_input@{ kpcli-py
, nixgl
, rust-overlay
, neovim-nightly-overlay
, system
, ...
}: let
kpcli-py = (final: prev: {
# use python3.9, which works because of cython somehow?
kpcli-py = final.poetry2nix.mkPoetryApplication {
projectDir = flake_input.kpcli-py;
python = final.python39;
overrides = final.poetry2nix.defaultPoetryOverrides.extend (self: super: {
# tableformatter requires setuptools
tableformatter = super.tableformatter.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools super.cython_3 ];
}
);
});
};
});
# TODO: this is quite harmful to add globally. nixGL is built not to be pure
nixgl.overlays.default
rust-overlay.overlays.default
neovim-nightly-overlay.overlay
(final: prev:
rust = (final: prev:
let
nightlyRustWithExts = exts: final.rust-bin.selectLatestNightlyWith (
toolchain: (toolchain.minimal.override {
@ -17,26 +31,16 @@ flake_input@{ kpcli-py, nixgl, rust-overlay, neovim-nightly-overlay, ... }: [
# https://rust-lang.github.io/rustup/concepts/profiles.html
rust-default-components = [ "rust-docs" "rustfmt" "clippy" ];
rust-dev-components = rust-default-components ++ [ "rust-src" "rust-analyzer" "miri" ];
in
{
# use python3.9, which works because of cython somehow?
kpcli-py = final.poetry2nix.mkPoetryApplication {
projectDir = kpcli-py;
python = final.python39;
overrides = final.poetry2nix.defaultPoetryOverrides.extend (self: super: {
# tableformatter requires setuptools
tableformatter = super.tableformatter.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools super.cython_3 ];
}
);
});
};
in {
rust4devs = nightlyRustWithExts rust-dev-components;
rust4cargo = nightlyRustWithExts [ ];
rust4normi = nightlyRustWithExts rust-default-components;
})
});
in [
nixgl.overlays.default
rust-overlay.overlays.default
neovim-nightly-overlay.overlay
rust
kpcli-py
]