new file: assets/.bashrc
new file: assets/direnvrc new file: assets/toolchains/rust/.envrc new file: assets/toolchains/rust/flake.nix new file: flake.lock modified: flake.nix renamed: hosts/blackstar/home-manager/home.nix -> home.nix deleted: hosts/rogue/home-manager/home.nix deleted: hosts/shared/home-manager/shared_home.nix modified: modules/nixos/rust-toolchain.nix new file: modules/nixos/rust-toolchain.toml new file: result
This commit is contained in:
parent
df2ca4d8d8
commit
bd6a2bebb6
12 changed files with 214 additions and 175 deletions
0
assets/.bashrc
Normal file
0
assets/.bashrc
Normal file
0
assets/direnvrc
Normal file
0
assets/direnvrc
Normal file
1
assets/toolchains/rust/.envrc
Normal file
1
assets/toolchains/rust/.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use flake
|
57
assets/toolchains/rust/flake.nix
Normal file
57
assets/toolchains/rust/flake.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
description = "A Nix-flake-based Rust development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, rust-overlay }:
|
||||
let
|
||||
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ rust-overlay.overlays.default self.overlays.default ];
|
||||
};
|
||||
});
|
||||
in
|
||||
{
|
||||
overlays.default = final: prev: {
|
||||
rustToolchain =
|
||||
let
|
||||
rust = prev.rust-bin;
|
||||
in
|
||||
if builtins.pathExists ./rust-toolchain.toml then
|
||||
rust.fromRustupToolchainFile ./rust-toolchain.toml
|
||||
else if builtins.pathExists ./rust-toolchain then
|
||||
rust.fromRustupToolchainFile ./rust-toolchain
|
||||
else
|
||||
rust.stable.latest.default.override {
|
||||
extensions = [ "rust-src" "rustfmt" ];
|
||||
};
|
||||
};
|
||||
|
||||
devShells = forEachSupportedSystem ({ pkgs }: {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
rustToolchain
|
||||
openssl
|
||||
pkg-config
|
||||
cargo-deny
|
||||
cargo-edit
|
||||
cargo-watch
|
||||
rust-analyzer
|
||||
];
|
||||
|
||||
env = {
|
||||
# Required by rust-analyzer
|
||||
RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library";
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
86
flake.lock
generated
Normal file
86
flake.lock
generated
Normal file
|
@ -0,0 +1,86 @@
|
|||
{
|
||||
"nodes": {
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722630065,
|
||||
"narHash": "sha256-QfM/9BMRkCmgWzrPDK+KbgJOUlSJnfX4OvsUupEUZvA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "afc892db74d65042031a093adb6010c4c3378422",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1722651103,
|
||||
"narHash": "sha256-IRiJA0NVAoyaZeKZluwfb2DoTpBAj+FLI0KfybBeDU0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a633d89c6dc9a2a8aae11813a62d7c58b2c0cc51",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1722630782,
|
||||
"narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d04953086551086b44b6f3c6b7eeb26294f207da",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722738111,
|
||||
"narHash": "sha256-cWD5pCs9AYb+512/yCx9D0Pl5KcmyuXHeJpsDw/D1vs=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "27ec296d93cb4b2d03e8cbd019b1b4cde8c34280",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
19
flake.nix
19
flake.nix
|
@ -10,8 +10,10 @@
|
|||
# Also see the 'unstable-packages' overlay at 'overlays/default.nix'.
|
||||
|
||||
# Home manager
|
||||
home-manager.url = "github:nix-community/home-manager/release-24.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
#nur.url = "github:nix-community/NUR";
|
||||
rust-overlay = {
|
||||
|
@ -65,7 +67,10 @@
|
|||
modules = [
|
||||
# > Our main nixos configuration file <
|
||||
./hosts/blackstar/nixos/configuration.nix
|
||||
./modules/nixos/rust-toolchain.nix
|
||||
#({ pkgs, ... }: {
|
||||
# nixpkgs.overlays = [ rust-overlay.overlays.default ];
|
||||
# import = [ ./modules/nixos/rust-toolchain.nix ];
|
||||
# })
|
||||
];
|
||||
};
|
||||
rogue = nixpkgs.lib.nixosSystem {
|
||||
|
@ -73,6 +78,10 @@
|
|||
modules = [
|
||||
# > Our main nixos configuration file <
|
||||
./hosts/rogue/nixos/configuration.nix
|
||||
({ pkgs, ... }: {
|
||||
nixpkgs.overlays = [ rust-overlay.overlays.default ];
|
||||
environment.systemPackages = [ pkgs.rust-bin.stable.latest.default ];
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
|
@ -86,7 +95,7 @@
|
|||
extraSpecialArgs = {inherit inputs outputs;};
|
||||
modules = [
|
||||
# > Our main home-manager configuration file <
|
||||
./hosts/blackstar/home-manager/home.nix
|
||||
./home.nix
|
||||
];
|
||||
};
|
||||
"aces@rogue" = home-manager.lib.homeManagerConfiguration {
|
||||
|
@ -94,7 +103,7 @@
|
|||
extraSpecialArgs = {inherit inputs outputs;};
|
||||
modules = [
|
||||
# > Our main home-manager configuration file <
|
||||
./hosts/rogue/home-manager/home.nix
|
||||
./home.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# ./nvim.nix
|
||||
|
||||
# Shared config
|
||||
../../shared/home-manager/shared_home.nix
|
||||
#../../shared/home-manager/shared_home.nix
|
||||
];
|
||||
|
||||
nixpkgs = {
|
||||
|
@ -67,7 +67,13 @@
|
|||
home.stateVersion = "24.05";
|
||||
home.file = {
|
||||
".face" = {
|
||||
source = ./assets/avatar.png;
|
||||
source = ../assets/avatar.png;
|
||||
}
|
||||
"Documents/projects/rust/flake.nix" = {
|
||||
source = ../assets/toolchains/rust/flake.nix
|
||||
}
|
||||
"Documents/projects/rust/.envrc" = {
|
||||
source = ../assets/toolchains/rust/.envrc
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -152,4 +158,7 @@
|
|||
userName = "Seven Of Aces";
|
||||
userEmail = "sevenofaces42@gmail.com";
|
||||
};
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
# This is your home-manager configuration file
|
||||
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
|
||||
{
|
||||
inputs,
|
||||
outputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
# You can import other home-manager modules here
|
||||
imports = [
|
||||
# If you want to use modules your own flake exports (from modules/home-manager):
|
||||
# outputs.homeManagerModules.example
|
||||
# Or modules exported from other flakes (such as nix-colors):
|
||||
# inputs.nix-colors.homeManagerModules.default
|
||||
|
||||
# You can also split up your configuration and import pieces of it here:
|
||||
# ./nvim.nix
|
||||
|
||||
# Shared config
|
||||
../../shared/home-manager/shared_home.nix
|
||||
];
|
||||
|
||||
nixpkgs = {
|
||||
# You can add overlays here
|
||||
overlays = [
|
||||
# Add overlays your own flake exports (from overlays and pkgs dir):
|
||||
outputs.overlays.additions
|
||||
outputs.overlays.modifications
|
||||
outputs.overlays.unstable-packages
|
||||
|
||||
# You can also add overlays exported from other flakes:
|
||||
# neovim-nightly-overlay.overlays.default
|
||||
|
||||
# Or define it inline, for example:
|
||||
# (final: prev: {
|
||||
# hi = final.hello.overrideAttrs (oldAttrs: {
|
||||
# patches = [ ./change-hello-to-hi.patch ];
|
||||
# });
|
||||
# })
|
||||
];
|
||||
# Configure your nixpkgs instance
|
||||
config = {
|
||||
# Disable if you don't want unfree packages
|
||||
allowUnfree = true;
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: Set your username
|
||||
home = {
|
||||
username = "aces";
|
||||
homeDirectory = "/home/aces";
|
||||
};
|
||||
|
||||
# Add stuff for your user as you see fit:
|
||||
# programs.neovim.enable = true;
|
||||
# home.packages = with pkgs; [ steam ]
|
||||
|
||||
# Enable home-manager and git
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
# Nicely reload system units when changing configs
|
||||
systemd.user.startServices = "sd-switch";
|
||||
|
||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||
home.stateVersion = "24.05";
|
||||
home.file = {
|
||||
".face" = {
|
||||
source = ./assets/avatar.png;
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
|
||||
# Install extensions from NUR
|
||||
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
|
||||
ublock-origin
|
||||
darkreader
|
||||
];
|
||||
|
||||
# Privacy about:config settings
|
||||
profiles.notus = {
|
||||
settings = {
|
||||
"browser.send_pings" = false;
|
||||
"browser.urlbar.speculativeConnect.enabled" = false;
|
||||
"dom.event.clipboardevents.enabled" = true;
|
||||
"media.navigator.enabled" = false;
|
||||
"network.cookie.cookieBehavior" = 1;
|
||||
"network.http.referer.XOriginPolicy" = 2;
|
||||
"network.http.referer.XOriginTrimmingPolicy" = 2;
|
||||
"beacon.enabled" = false;
|
||||
"browser.safebrowsing.downloads.remote.enabled" = false;
|
||||
"network.IDN_show_punycode" = true;
|
||||
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
|
||||
"app.shield.optoutstudies.enabled" = false;
|
||||
"dom.security.https_only_mode_ever_enabled" = true;
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||
"browser.toolbars.bookmarks.visibility" = "never";
|
||||
"geo.enabled" = false;
|
||||
|
||||
# Disable telemetry
|
||||
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
|
||||
"browser.ping-centre.telemetry" = false;
|
||||
"browser.tabs.crashReporting.sendReport" = false;
|
||||
"devtools.onboarding.telemetry.logged" = false;
|
||||
"toolkit.telemetry.enabled" = false;
|
||||
"toolkit.telemetry.unified" = false;
|
||||
"toolkit.telemetry.server" = "";
|
||||
|
||||
# Disable Pocket
|
||||
"browser.newtabpage.activity-stream.feeds.discoverystreamfeed" = false;
|
||||
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
|
||||
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
|
||||
"browser.newtabpage.activity-stream.showSponsored" = false;
|
||||
"extensions.pocket.enabled" = false;
|
||||
|
||||
# Disable prefetching
|
||||
"network.dns.disablePrefetch" = true;
|
||||
"network.prefetch-next" = false;
|
||||
|
||||
# Disable JS in PDFs
|
||||
"pdfjs.enableScripting" = false;
|
||||
|
||||
# Harden SSL
|
||||
"security.ssl.require_safe_negotiation" = true;
|
||||
|
||||
# Extra
|
||||
"identity.fxaccounts.enabled" = false;
|
||||
"browser.search.suggest.enabled" = false;
|
||||
"browser.urlbar.shortcuts.bookmarks" = false;
|
||||
"browser.urlbar.shortcuts.history" = false;
|
||||
"browser.urlbar.shortcuts.tabs" = false;
|
||||
"browser.urlbar.suggest.bookmark" = false;
|
||||
"browser.urlbar.suggest.engines" = false;
|
||||
"browser.urlbar.suggest.history" = false;
|
||||
"browser.urlbar.suggest.openpage" = false;
|
||||
"browser.urlbar.suggest.topsites" = false;
|
||||
"browser.uidensity" = 1;
|
||||
"media.autoplay.enabled" = false;
|
||||
"toolkit.zoomManager.zoomValues" = ".8,.90,.95,1,1.1,1.2";
|
||||
|
||||
"privacy.firstparty.isolate" = true;
|
||||
"network.http.sendRefererHeader" = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.git = {
|
||||
enabled = true;
|
||||
userName = "Seven Of Aces";
|
||||
userEmail = "sevenofaces42@gmail.com";
|
||||
};
|
||||
}
|
|
@ -3,10 +3,47 @@
|
|||
outputs,
|
||||
lib,
|
||||
config,
|
||||
rust-overlay,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
nixpkgs.overlays = [ rust-overlay.overlays.default ];
|
||||
environment.systemPackages = [ pkgs.rust-bin.stable.latest.default ];
|
||||
}:
|
||||
let
|
||||
overrides = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml));
|
||||
libPath = with pkgs; lib.makeLibraryPath [
|
||||
# load external libraries that you need in your rust project here
|
||||
];
|
||||
in
|
||||
pkgs.mkShell rec {
|
||||
buildInputs = with pkgs; [
|
||||
gcc
|
||||
clang
|
||||
# Replace llvmPackages with llvmPackages_X, where X is the latest LLVM version (at the time of writing, 16)
|
||||
llvmPackages.bintools
|
||||
rustup
|
||||
];
|
||||
shellHook = ''
|
||||
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
|
||||
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
|
||||
'';
|
||||
|
||||
RUSTC_VERSION = overrides.toolchain.channel;
|
||||
# https://github.com/rust-lang/rust-bindgen#environment-variables
|
||||
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ];
|
||||
# Add precompiled library to rustc search path
|
||||
RUSTFLAGS = (builtins.map (a: ''-L ${a}/lib'') [
|
||||
# add libraries here (e.g. pkgs.libvmi)
|
||||
]);
|
||||
LD_LIBRARY_PATH = libPath;
|
||||
# Add glibc, clang, glib, and other headers to bindgen search path
|
||||
BINDGEN_EXTRA_CLANG_ARGS =
|
||||
# Includes normal include path
|
||||
(builtins.map (a: ''-I"${a}/include"'') [
|
||||
# add dev libraries here (e.g. pkgs.libvmi.dev)
|
||||
pkgs.glibc.dev
|
||||
])
|
||||
# Includes with special directory paths
|
||||
++ [
|
||||
''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
|
||||
''-I"${pkgs.glib.dev}/include/glib-2.0"''
|
||||
''-I${pkgs.glib.out}/lib/glib-2.0/include/''
|
||||
];
|
||||
}
|
2
modules/nixos/rust-toolchain.toml
Normal file
2
modules/nixos/rust-toolchain.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
[toolchain]
|
||||
channel = "stable"
|
1
result
Symbolic link
1
result
Symbolic link
|
@ -0,0 +1 @@
|
|||
/nix/store/6l8s1fmrmy8fv4l9qyzwfm63cg3c2dns-home-manager-generation
|
Reference in a new issue