-
-
Notifications
You must be signed in to change notification settings - Fork 21
usage: add Nix guide #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
usage: add Nix guide #136
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0d6facd
usage: add Nix guide
zackerthescar 781b291
Apply suggestion from @nothingneko
nothingneko 979243f
Apply suggestion from @Owen-sz
nothingneko c06038e
Apply suggestion from @Owen-sz
nothingneko 56fb737
Apply suggestion from @nothingneko
nothingneko 0efaa1b
Update src/content/docs/en/usage/nix.mdx
nothingneko 870a7e8
Update src/consts.ts
nothingneko 13fae4d
Apply suggestions from code review
nothingneko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| --- | ||
| title: Nix | ||
| description: "Getting Started with Nix on Ultramarine Linux" | ||
| --- | ||
|
|
||
| Nix is a package manager aiming to provide reproducable development | ||
| environments and builds by removing _dependency hell_. For us, this means | ||
| no longer having to install `-devel` packages we only use occasionally, | ||
|
nothingneko marked this conversation as resolved.
|
||
| ephemeral shells that we can create for temporarily checking out utilities, | ||
| quickly assimilating into codebases with a `flake.nix` file, and more! | ||
|
|
||
|
nothingneko marked this conversation as resolved.
|
||
| The world of Nix is vast and difficult to navigate, so let's see Nix in action | ||
| with real-world examples: | ||
|
|
||
| # Installing Nix | ||
|
|
||
| Ultramarine provides a quick Nix installer. Simply run: | ||
|
|
||
| ```bash | ||
| $ um tweaks enable nix | ||
| ``` | ||
|
|
||
| # Real-world example 1: Ephemeral shell | ||
|
|
||
| Let's say you wanna try a cute new package, like something that prints out a | ||
| cute little character saying a string, but you don't really feel like | ||
| installing yet another system package. | ||
|
|
||
| ```bash | ||
| $ nix run nixpkgs#ponysay "hey nixos is pretty cool" | ||
| ``` | ||
|
|
||
| # Real-world example 2: Schmoyalties | ||
|
|
||
| FFmpeg hides some great functionality behind a compile-time `--enable-nonfree` | ||
| flag that makes the resulting binary not something a repository can legally | ||
| distribute, requiring the end user to compile it with their desired settings | ||
| instead. If only there was a way to manage that elegantly (i.e not under | ||
| `make` and `make install` that overwrites the system FFmpeg). | ||
|
|
||
| `nix flake init` in a folder, then paste this into `flake.nix` (overriding | ||
| the default): | ||
|
|
||
| ```nix | ||
| { | ||
| inputs = { | ||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
| flake-utils.url = "github:numtide/flake-utils"; | ||
| }; | ||
| outputs = { self, nixpkgs, flake-utils }: | ||
| flake-utils.lib.eachDefaultSystem | ||
| (system: | ||
| let | ||
| pkgs = import nixpkgs { | ||
| inherit system; | ||
| overlays = [ | ||
| (self: super: {ffmpeg = super.ffmpeg.override { | ||
| ## We define the build options here | ||
| withUnfree = true; | ||
| withDav1d = true; | ||
| withFdkAac = true; | ||
| };}) | ||
| }; | ||
| in | ||
| with pkgs; | ||
| { | ||
| devShells.default = mkShell { | ||
| buildInputs = [ | ||
| ffmpeg | ||
| ]; | ||
| }; | ||
| } | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| Then `nix develop`, wait, and bam! FFmpeg with all the nitty-gritty unfree | ||
| codecs~ | ||
|
|
||
| # Real-world example 3: Working with a Nix project | ||
|
|
||
| TBD | ||
|
|
||
| # End | ||
|
|
||
| I hope you get some use out of Nix | ||
| within Ultramarine Linux. Whether you're a poweruser or a developer, you'll | ||
|
nothingneko marked this conversation as resolved.
Outdated
|
||
| find great power within Nix. | ||
|
|
||
|
nothingneko marked this conversation as resolved.
|
||
|
|
||
| And hey, if you're still not sold on it, the tweak is a toggleable, and we've | ||
| made sure to make it a clean uninstall so you'll be back to a "clean" machine | ||
| if you're still not convinced (or if you run out of storage, Nix can get a | ||
| little unwieldy). | ||
|
|
||
| #### [Next Up: Linux Concepts: What is Linux? →](/en/linux/overview) | ||
|
|
||
| #### [← Back To: eduroam](/en/usage/eduroam/) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.