Compare commits
2 Commits
e253bf58eb
...
fc279ae3b7
Author | SHA1 | Date |
---|---|---|
Pratham Patel | fc279ae3b7 | |
Pratham Patel | 859e052556 |
38
flake.lock
38
flake.lock
|
@ -1,5 +1,26 @@
|
|||
{
|
||||
"nodes": {
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1706981411,
|
||||
"narHash": "sha256-cLbLPTL1CDmETVh4p0nQtvoF+FSEjsnJTFpTxhXywhQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "652fda4ca6dafeb090943422c34ae9145787af37",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-23.11",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixlib": {
|
||||
"locked": {
|
||||
"lastModified": 1709426687,
|
||||
|
@ -23,11 +44,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709557527,
|
||||
"narHash": "sha256-PV8oYqhTHX6FGZMQ1m5dhRuS914AhofPwgnAMhUZtwE=",
|
||||
"lastModified": 1709821158,
|
||||
"narHash": "sha256-76L6tymnmFY3zDPBi0Mi5G6HcISHKw7xHuYYmzKrTK4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-generators",
|
||||
"rev": "d048d6fc4bada612ff08d4b9d5edc48d45389431",
|
||||
"rev": "10e801a76fa611f8ce7937e2c9b7677888a54fa0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -38,12 +59,12 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1709569716,
|
||||
"narHash": "sha256-iOR44RU4jQ+YPGrn+uQeYAp7Xo7Z/+gT+wXJoGxxLTY=",
|
||||
"rev": "617579a787259b9a6419492eaac670a5f7663917",
|
||||
"revCount": 556422,
|
||||
"lastModified": 1709677081,
|
||||
"narHash": "sha256-tix36Y7u0rkn6mTm0lA45b45oab2cFLqAzDbJxeXS+c=",
|
||||
"rev": "880992dcc006a5e00dd0591446fdf723e6a51a64",
|
||||
"revCount": 556459,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.556422%2Brev-617579a787259b9a6419492eaac670a5f7663917/018e0df2-b0f7-7a27-af1a-04150ef0f2c7/source.tar.gz"
|
||||
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.556459%2Brev-880992dcc006a5e00dd0591446fdf723e6a51a64/018e17b1-5573-70b6-b970-a1348ee66a5b/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
|
@ -52,6 +73,7 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixos-generators": "nixos-generators",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
|
|
21
flake.nix
21
flake.nix
|
@ -1,11 +1,19 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
|
||||
nixos-generators.url = "github:nix-community/nixos-generators";
|
||||
nixos-generators.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-23.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nixos-generators = {
|
||||
url = "github:nix-community/nixos-generators";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixos-generators, ... }:
|
||||
outputs = { self, nixpkgs, nixos-generators, home-manager, ... } @attrs:
|
||||
let
|
||||
# helpers for producing system-specific outputs
|
||||
supportedSystems = [
|
||||
|
@ -15,15 +23,14 @@
|
|||
];
|
||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
inherit system;
|
||||
});
|
||||
in
|
||||
{
|
||||
packages = forEachSupportedSystem ({ pkgs, system, ... }: {
|
||||
packages = forEachSupportedSystem ({ pkgs, ... }: {
|
||||
default = nixos-generators.nixosGenerate {
|
||||
inherit system;
|
||||
inherit (pkgs) system;
|
||||
specialArgs = attrs;
|
||||
format = "install-iso";
|
||||
|
||||
modules = [ ./iso.nix ];
|
||||
};
|
||||
});
|
||||
|
|
252
iso.nix
252
iso.nix
|
@ -1,6 +1,14 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
{ lib, pkgs, config, home-manager, ... }:
|
||||
|
||||
let
|
||||
NixOSMajor = builtins.elemAt (lib.versions.splitVersion lib.version) 0;
|
||||
NixOSMinor = builtins.elemAt (lib.versions.splitVersion lib.version) 1;
|
||||
NixOSRelease = "${NixOSMajor}.${NixOSMinor}";
|
||||
in
|
||||
|
||||
{
|
||||
imports = [ home-manager.nixosModules.default ];
|
||||
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
# since the latest kernel package is installed, there will be a ZFS conflict because
|
||||
|
@ -20,30 +28,236 @@
|
|||
hardwareClockInLocalTime = true;
|
||||
};
|
||||
|
||||
# yes I know that 'programs.<pkg>.enable' exist but this is just an ISO
|
||||
nixpkgs.config.allowUnfree = true; # allow non-FOSS pkgs
|
||||
environment.systemPackages = with pkgs; [
|
||||
bat
|
||||
btop
|
||||
curl
|
||||
# base system packages + packages what I *need*
|
||||
cloud-utils # provides growpart
|
||||
dig # provides dig and nslookup
|
||||
dmidecode
|
||||
file
|
||||
git
|
||||
gnutar
|
||||
htop
|
||||
iperf
|
||||
neovim
|
||||
parted
|
||||
pciutils
|
||||
perl
|
||||
ripgrep
|
||||
findutils
|
||||
gawk
|
||||
gettext # for translation (human lang; Eng <-> Hindi)
|
||||
gnugrep
|
||||
gnused
|
||||
hdparm
|
||||
inotify-tools
|
||||
iproute2
|
||||
iputils
|
||||
lsof
|
||||
minisign
|
||||
nvme-cli
|
||||
parallel
|
||||
pciutils # provides lspci and setpci
|
||||
pinentry # pkg summary: GnuPG’s interface to passphrase input
|
||||
procps # provides pgrep, kill, watch, ps, pidof, uptime, sysctl, free, etc
|
||||
psmisc # provides killall, fuser, pslog, pstree, etc
|
||||
pv
|
||||
python3Minimal
|
||||
rsync
|
||||
tmux
|
||||
smartmontools
|
||||
tree
|
||||
unzip
|
||||
vim
|
||||
usbutils
|
||||
util-linux # provides blkid, losetup, lsblk, rfkill, fallocate, dmesg, etc
|
||||
vim # it is a necessity
|
||||
wol
|
||||
|
||||
# shells
|
||||
dash
|
||||
|
||||
# download clients
|
||||
curl
|
||||
wget
|
||||
|
||||
# compression and decompression
|
||||
bzip2
|
||||
gnutar
|
||||
gzip
|
||||
unzip
|
||||
xz
|
||||
zip
|
||||
zstd
|
||||
|
||||
# programming tools + compilers
|
||||
#cargo-deb # generate .deb packages solely based on Cargo.toml
|
||||
#cargo-ndk # extension for building Android NDK projects
|
||||
#binutils # provides readelf, objdump, strip, as, objcopy (GNU; not LLVM)
|
||||
#gdb
|
||||
b4 # applying patches from mailing lists
|
||||
cargo-audit # audit crates for security vulnerabilities
|
||||
cargo-benchcmp # compare Rust micro-benchmarks
|
||||
cargo-binstall # install Rust binaries instead of building them from src
|
||||
cargo-bisect-rustc # find exactly which rustc commit/release-version which prevents your code from building now
|
||||
cargo-bloat # find what takes the most space in the executable
|
||||
cargo-cache # manage cargo cache (${CARGO_HOME}); print and remove dirs selectively
|
||||
cargo-chef # for speeding up container builds using layer caching
|
||||
cargo-deps # build dependency graph of Rust projects
|
||||
cargo-dist # distribute on crates.io
|
||||
cargo-flamegraph # flamegraphs without Perl or pipes
|
||||
cargo-hack # build project with all the possible variations of options/flags and check which ones fail and/or succeed
|
||||
cargo-outdated # show outdated deps
|
||||
cargo-profiler # profile Rust binaries
|
||||
cargo-public-api # detect breaking API changes and semver violations
|
||||
cargo-show-asm # display ASM, LLVM-IR, MIR and WASM for the Rust src
|
||||
cargo-sweep # cleanup unused build files
|
||||
cargo-udeps # find unused dependencies
|
||||
cargo-update # update installed binaries
|
||||
cargo-valgrind
|
||||
cargo-vet # ensure that the third-party dependencies are audited by a trusted source
|
||||
cargo-watch # run cargo commands when the src changes
|
||||
rustup # provides rustfmt, cargo-clippy, rustup, cargo, rust-lldb, rust-analyzer, rustc, rust-gdb, cargo-fmt
|
||||
|
||||
# power management
|
||||
acpi
|
||||
lm_sensors
|
||||
|
||||
# dealing with other distro's packages
|
||||
dpkg
|
||||
rpm
|
||||
|
||||
# for media consumption, manipulation and metadata info
|
||||
ffmpeg
|
||||
imagemagick
|
||||
mediainfo
|
||||
|
||||
# network monitoring
|
||||
iperf # this is iperf3
|
||||
iperf2 # this is what is usually 'iperf' on other distros
|
||||
nload
|
||||
|
||||
# other utilities
|
||||
asciinema
|
||||
buildah
|
||||
fzf
|
||||
parted
|
||||
picocom
|
||||
ubootTools
|
||||
ventoy
|
||||
|
||||
# utilities written in Rust
|
||||
choose
|
||||
du-dust
|
||||
dua
|
||||
fd
|
||||
hyperfine
|
||||
procs
|
||||
sd
|
||||
tre-command
|
||||
|
||||
# virtualisation
|
||||
qemu_kvm
|
||||
|
||||
# tools specific to Nix
|
||||
nix-output-monitor
|
||||
nvd # diff between NixOS generations
|
||||
];
|
||||
|
||||
programs = {
|
||||
adb.enable = true;
|
||||
bandwhich.enable = true;
|
||||
ccache.enable = true;
|
||||
command-not-found.enable = true;
|
||||
dconf.enable = true;
|
||||
git.enable = true;
|
||||
gnupg.agent.enable = true;
|
||||
htop.enable = true;
|
||||
iotop.enable = true;
|
||||
mtr.enable = true;
|
||||
skim.fuzzyCompletion = true;
|
||||
sniffnet.enable = true;
|
||||
tmux.enable = true;
|
||||
traceroute.enable = true;
|
||||
trippy.enable = true;
|
||||
usbtop.enable = true;
|
||||
|
||||
bash = {
|
||||
enableCompletion = true;
|
||||
# notifications when long-running terminal commands complete
|
||||
undistractMe = {
|
||||
enable = true;
|
||||
playSound = true;
|
||||
timeout = 300; # notify only if said command has been running for this many seconds
|
||||
};
|
||||
# aliases for the root user
|
||||
# doesn't affect 'pratham' since there is an `unalias -a` in /home/pratham/.bashrc
|
||||
shellAliases = {
|
||||
"e" = "${pkgs.vim}/bin/vim";
|
||||
};
|
||||
};
|
||||
|
||||
nano = {
|
||||
enable = true;
|
||||
syntaxHighlight = true;
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.nixos = { lib, pkgs, ... }: {
|
||||
home = {
|
||||
stateVersion = "${NixOSRelease}";
|
||||
username = "nixos";
|
||||
homeDirectory = "/home/nixos";
|
||||
};
|
||||
|
||||
programs = {
|
||||
aria2.enable = true;
|
||||
bat.enable = true;
|
||||
bottom.enable = true;
|
||||
broot.enable = true;
|
||||
btop.enable = true;
|
||||
ripgrep.enable = true;
|
||||
tealdeer.enable = true;
|
||||
yt-dlp.enable = true;
|
||||
zoxide.enable = true;
|
||||
|
||||
direnv = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
neovim = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
clang-tools # provides clangd
|
||||
gcc # for nvim-tree's parsers
|
||||
lldb # provides lldb-vscode
|
||||
lua-language-server
|
||||
nil # language server for Nix
|
||||
nixpkgs-fmt
|
||||
nodePackages.bash-language-server
|
||||
ruff
|
||||
shellcheck
|
||||
tree-sitter # otherwise nvim complains that the binary 'tree-sitter' is not found
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
home.file."get-git-repos" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
set -x
|
||||
while ! ping 1.1.1.1 -c 1 1>/dev/null || ! ping 8.8.8.8 -c 1 1>/dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
repoURL='https://gitlab.com/thefossguy/dotfiles'
|
||||
targetDir="$HOME/.dotfiles"
|
||||
if [[ ! -d "$targetDir" ]]; then
|
||||
${pkgs.git}/bin/git clone --bare "$repoURL" "$targetDir"
|
||||
${pkgs.git}/bin/git --git-dir="$targetDir" --work-tree="$HOME" checkout -f
|
||||
rm -rf "$HOME/.config/nvim"
|
||||
fi
|
||||
|
||||
repoURL='https://gitlab.com/thefossguy/prathams-nixos'
|
||||
targetDir="$HOME/prathams-nixos"
|
||||
if [[ ! -d "$targetDir" ]]; then
|
||||
${pkgs.git}/bin/git clone "$repoURL" "$targetDir"
|
||||
fi
|
||||
set +x
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
environment.variables = {
|
||||
# for 'sudo -e' || 'sudoedit'
|
||||
EDITOR = "nvim";
|
||||
|
@ -54,8 +268,6 @@
|
|||
TERM = "xterm-256color";
|
||||
};
|
||||
|
||||
isoImage.squashfsCompression = "zstd -Xcompression-level 22";
|
||||
|
||||
# yes, I want docs
|
||||
documentation = {
|
||||
enable = true;
|
||||
|
@ -67,4 +279,6 @@
|
|||
generateCaches = true;
|
||||
};
|
||||
};
|
||||
|
||||
isoImage.squashfsCompression = "zstd -Xcompression-level 22";
|
||||
}
|
||||
|
|
12
mkiso.sh
12
mkiso.sh
|
@ -8,11 +8,15 @@ if [ "$(uname -s)" != 'Linux' ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
time nom build .
|
||||
time nom build --show-trace .
|
||||
|
||||
for resultISO in $(basename result/iso/nixos-*-"$(uname -m)"-linux.iso); do
|
||||
cp result/iso/"${resultISO}" .
|
||||
sha512sum "${resultISO}" | awk '{print $1}' | tee "${resultISO}.sha512"
|
||||
for resultISO in $(basename result/iso/nixos-*-linux.iso); do
|
||||
if [ ! -f "${resultISO}" ]; then
|
||||
cp result/iso/"${resultISO}" .
|
||||
fi
|
||||
if [ ! -f "${resultISO}.sha512" ]; then
|
||||
sha512sum "${resultISO}" | awk '{print $1}' 1> "${resultISO}.sha512"
|
||||
fi
|
||||
chown "${USER}:${USER}" "${resultISO}"
|
||||
chmod 644 "${resultISO}"
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue