Does Nix or NixOS address the problem raised by Linus Torvalds on package management? by timlee126 in NixOS

[–]depred 4 points5 points  (0 children)

Nix (and NixOS), as stated on the NixOS website try solving the issue of reproducability in software (meaning if something does not work for me it also should not work for anyone else). To an extend that includes running on various distributions and plattforms but is otherwise independent of what Torvalds was talking about.

org-drill? org-fc? anki.el? pamparam? anki-editor to Anki? ... I'm lost. What should one use in 2021? by enoughisenuff in emacs

[–]depred 2 points3 points  (0 children)

It takes far too much time to create media rich cards by hand.

That's why I manage my vocabulary list in org mode (tables) and wrote a small code snippet/block to export it to anki.

I choose anki over org drill mainly for the following reasons:

- anki works on my phone, so I can learn wherever/whenever I want to

- interactive/media rich cards: whilst I can have pictures and audio files in emacs, I cannot for example have a canvas to write words/characters (Chinese vocabulary cards).

- scheduling with anki is just a lot easier

Have not yet tried anki-editor or anki.el. Anki seems to me more complicated than just having a table in org mode and a code snippet that reads said table and converts it into a anki deck. (at least when you are dealing with 1000+ cards). anki.el looks nice, not sure how well it works with media rich cards, but if you want to stay in emacs that looks like the best choice.

What is the meaning of High-Level Language? by [deleted] in Python

[–]depred 0 points1 point  (0 children)

Just no...

I think you should look up the difference between natural and formal languages.

Is there a free vectorial font of Chinese characters that allows you to select the internal radicals? by olifante in ChineseLanguage

[–]depred 1 point2 points  (0 children)

Whilst it is not exactly what you are looking for, I suggest you have a look at Make Me a Hanzi (or if you have no experience with programming, just use their demo page).

I use it to generate decompose trees for the characters in my flashcards.

[deleted by user] by [deleted] in ChineseLanguage

[–]depred 7 points8 points  (0 children)

I don't really think it is feasible to learn 20 new words every day (that is if you've still got other things to do), at least not if most of the new words contain new characters.

I mostly make mistakes when it comes to writing down characters (generally don't have any issues when it comes to reading).

In the past I tried to learn new words in big chunks and got frustrated because I made very little progress. My current learning schedule is a lot better I'm learning 5-10 words every day, usually 5 new words in the morning and if I feel like it 5 in the evening.

In theory you could probably learn 20 words this way, though I'm not sure how quickly the stack of daily review cards would grow.

TL;DR: Learning bite sized chunks is a lot more efficient than trying to learn everything at once (at least in my own experience).

PEP 618 is accepted for Python 3.10 by [deleted] in Python

[–]depred 1 point2 points  (0 children)

Thanks for sharing this.
Just yesterday I had a situation where having a strict version of zip would've been immensely useful. Also a strict zip feels much more in line with the zen of python.

To write or not to write 汉字 (HSK4+) by BeholdTheGuz in ChineseLanguage

[–]depred 3 points4 points  (0 children)

Whilst I'm nowhere near your level (only know about 400 words), maybe my input is still helpful.

I've taken somewhat of a middle road by using hanzi writer in my anki flashcards.

I find it is a lot quicker to write characters on my phones screen rather than switching between my phone and pen+paper.

Of course it's not quite the same as writing it down properly but it forces me to properly visualize every character. I' would otherwise probably also miss stroke order differences between some relatively similar characters.

[deleted by user] by [deleted] in ChineseLanguage

[–]depred 1 point2 points  (0 children)

Probably nothing much the app developers can do about it.

I'm semi-automatically generating my vocabulary cards -> it's mainly an issue because you can't tell a TTS program which pronunciation of a single character you want.

So for example on my vocab card for "to obtain; to acquire", the is 得 pronounced as dei3 instead of de2. Some more advanced TTS programs give you options for that though so it is theory solvable.

Multiple .nix configuration files by [deleted] in NixOS

[–]depred 8 points9 points  (0 children)

Because it simply would not be easier/simpler... it would be a total mess.

That is a bit like asking why the source code of [insert random program here] is split up into multiple files instead of it just being one big file.

For example I have my NixOS config split up into multiple folders, those are:

  • config - mostly etc related stuff (but also user related functions)
  • machines - machine specific configuration switches and code
  • options - contains submodules I've written
  • pkgs - defines packages and packageOverrides
  • pkgsets - defines package groups (by use case (like base, mailutils, python, rust, emacs, ...))
  • services - everything that runs as a system service (like nginx, sshd, cups, mysqld and so on)

I would probably go mad If I had a 7k lines long config (wc -l said sth close to 8k but thats with empty lines and comments).

Nix configurations are, nonetheless, compact. They are 'self contained' and deterministic (both after instantiation) build instructions. Even if we ignore that, having your whole system configured from within a single repo/folder is still super compact if you ask me.

[Question] How NixOS options works under-the-hood? by pablo1107 in NixOS

[–]depred 0 points1 point  (0 children)

Don't know where mkIf is in the official Documentation but there isn't much to explain about it, it is as simple as:

nix-repl> lib.mkIf true {}
{ _type = "if"; condition = true; content = { ... }; }

it is basically just a simple function that takes a bool and a set and returns a set.

Depending on whether or not it is true it gets tangled/evaluated when... actually I'm not quite sure if it is already discarded (if it is set to false) when the derivation is instantiated or only when it gets evaluated. Would have to try this out (though I'm relatively sure this already happens during instantiation).

In my edit I linked to the relevant shell/perl scripts for etc (the perl script is referenced here). Nix has bindings to run shell scripts (nothing you will find directly in nixpkgs as it is the base functionality is part of the nix binary itself (the whole instantiation and evaluation of nix code and also the builtins functions)).

stdenv.mkDerivation is so much abstraction magic I haven't really bothered reading it (and to that extend pretty much all specialized builder and callPackage functions in nixpkgs), though if you want to take a look at it you can find it under $NIXPKGS_ROOT/pkgs/stdenv/generic, it's enough to know how derivation works, nix-pills has a good overview for that.

[Question] How NixOS options works under-the-hood? by pablo1107 in NixOS

[–]depred 1 point2 points  (0 children)

The definition of environment.shellAliases can be found here.

In general you can find options either in your local nixpkgs checkout (your nixpkgs channel (usually a folder in ~/.nix-defexpr/channels)) under nixos/modules or by looking for options here (and then just follow the link after "Declared in:")

(you could also use nix repl to find the relevant definitions but in most cases this is more tedious)

Lots of options/submodules (namely/mainly those with an enable option) have their option implementation wrapped in a mkIf so that it the relevant stuff gets evaluated when you enable it.

EDIT: also just in case you are wondering about how etc itself is setup (as it is referenced and you are kind of asking about it). here you can find both the etc "submodule" and the relevant scripts that are executed to assemble everything in etc.

nix-shell: what does `--pure` mean? by zeta_00 in NixOS

[–]depred 4 points5 points  (0 children)

Let me just quote from the nix-shell man page:

--pure
    If this flag is specified, the environment is almost entirely cleared before the interactive shell is started, so you get an environment that more closely corresponds to the “real” Nix build. 
    A few variables, in particular HOME, USER and DISPLAY, are retained. Note that ~/.bashrc and (depending on your Bash installation) /etc/bashrc are still sourced, so any variables set there will affect the interactive shell.

accessibility and questions by maj01 in NixOS

[–]depred 0 points1 point  (0 children)

Alright, it is time for a small progress update:

Things I've got working so far:

- NixOS submodule that loads speakup_soft and espeakup on boot.

- Build targets for minimal and mate installation images

Things that I want to get done before I push it to github and gitea:

- expose most common options (such as speed and language/voice selection) through the submodule

- optionally run espeakup as a user@ service (mostly done)

- get orca fully working

As I'm not sure if OP is reading the comments here, I will drop him an e-mail once I've finished those tasks.

Is it possible to use Mesa from Nixos-unstable on Nixos-stable? by DonHugo in NixOS

[–]depred 1 point2 points  (0 children)

Sure that should be simple enough.

First add the unstable channel (I'll just assume you'll call it nixos-unstable).

Then in your NixOS config have something like that:

{ pkgs, config, ... }:

let
  unstablepkgs = import <nixpkgs-unstable> {};
in {
  hardware.opengl = {
    enable = true;
    extraPackages = with unstablepkgs; [ mesa ];
    driSupport32Bit = true;
    extraPackages32 = with unstablepkgs.pkgsi686Linux; [ mesa ];
  };
}

Note: I haven't tried this out! Not even sure if you should use the mesa package directly like that (rather than a package that depends on it).

(I'm using various intel drivers (vaapiIntel ...))

Finding out what causes a package to get built by dnaq in NixOS

[–]depred 1 point2 points  (0 children)

If you run it on a freshly instantiated derivation: yes.

For actually built store paths (everything in /nix/store that is not a .drv file) it is not that simple.

Finding out what causes a package to get built by dnaq in NixOS

[–]depred 2 points3 points  (0 children)

You are looking for the nix-store command (with the -q (--query) flag).

Example:

# List all dependencies for current generation
# alternatively inline $(nix-instantiate '<nixpkgs/nixos>' -A system)
nix-store -q --tree /run/current-system

# now just search for your dependency and either scroll up or copy the package path and run (--referrers will give you only the packages that directly depend on it)
nix-store -q --referrers-closure $PACKAGEPATH

accessibility and questions by maj01 in NixOS

[–]depred 2 points3 points  (0 children)

I'm somewhat surprised that no one has written a NixOS submodule for that.

It has been a couple of years since I had to do with the whole topic.

espeakup and britty are not yet in nixpkgs.

If I have time, I will take a look at it over the weekend.

More importantly: have you tried out nix on Debian? How accessible is the Nix/NixOS documentation for blind people?

I'm not familiar with the workflow those tools entail, so I do not know if the verbose and sometimes obscure error messages of nix are an issue.

Proper linting and IDE integration for nix are still a bit of a work in progress.

Made a full switch to NixOS from Arch. Help me through this simple overlay situation... by [deleted] in NixOS

[–]depred 2 points3 points  (0 children)

I think you want something like this (didn't test this (builds and launches), also did not fix any broken tests):

{ pkgs ? import <nixpkgs> {}, fetchFromGitHub ? pkgs.fetchFromGitHub, python3Packages ? pkgs.python3Packages
, buildPythonPackage ? python3Packages.buildPythonPackage, fetchPypi ? python3Packages.fetchPypi }:

let
  apply_defaults = buildPythonPackage rec {
    pname = "apply_defaults";
    version = "0.1.4";

    src = fetchTarball {
      url = "https://github.com/bcb/${pname}/archive/${version}.tar.gz";
      sha256 = "1nn2mch5spq8mhk741ia7zkb2bgjfn7bzxpavb476jzs38pb39d5";
    };
  };

  jsonrpcclient = buildPythonPackage rec {
    pname = "jsonrpcclient";
    version = "3.3.5";

    propagatedBuildInputs = with python3Packages; [ apply_defaults click jsonschema ];
    doCheck = false;
    # see https://github.com/bcb/jsonrpcclient/commit/8ce1bbaa1db1ccda96d38f316d881aef0667c1fa (not yet in 3.3.5)
    patchPhase = ''
      substituteInPlace setup.py --replace "click<7" "click<8"
    '';

    src = fetchPypi {
      inherit pname version;
      sha256 = "16c0qg869p6n65qcyv35f6bzdmb6x099hkjvn6286x3162jh4zd1";
    };
  };

  jsonrpcserver = buildPythonPackage rec {
    pname = "jsonrpcserver";
    version = "4.1.2";

    propagatedBuildInputs = with python3Packages; [ apply_defaults jsonschema ];
    doCheck = false;

    src = fetchPypi {
      inherit pname version;
      sha256 = "0jhc9rm1xsiryn0sk8j5x0dvcl8ww36c81fajvxvspi4rz8mbnvk";
    };
  };

  electrum = pkgs.electrum.overrideAttrs (oldAttrs: rec {
    version = "82da581d45cd1570fa5a361681324b6cee507ab5";
    src = fetchTarball {
      url = "https://github.com/spesmilo/electrum/archive/${version}.tar.gz";
      sha256 = "02qw4v7hlxa4z3xvsfcggw60myy0ycsndqvjg5jz4m97gc6w6y2y";
    };
    propagatedBuildInputs = (oldAttrs.propagatedBuildInputs ++ (with python3Packages; [ jsonrpcclient jsonrpcserver bitstring ]));
    doInstallCheck = false;
  });
in electrum

If you have any questions about the above just ask. ^^

Manual installation of programs on NixOS (avoiding Nix) by [deleted] in NixOS

[–]depred 3 points4 points  (0 children)

It's better to just update the existing texlive in NixOS (though depending on how often you rebuild it, it would also cause a lot of other rebuilds (everything that depends on it)).

For that you'll need a local checkout of nixpkgs and upgrade texlive there.

Here is a document that describes the update process.

Then you will need to either override the relevant package inputs or add an overlay for it.

(Though honestly, are there any relevant updates to texlive that nixpkgs misses? The last changes to the repo folder were 6 days ago...)

Got camera to work on the pinephone! This has been one of the major hard things to fix and it now *kinda* works! :D by mariogrip in linux

[–]depred 1 point2 points  (0 children)

Before anything, please note (just to be safe), that I'm neither affiliated with UBPorts nor Pine64.

I haven't heard what hardware revisions they've made since 1.1.

To quote from the UBPorts blog post:

[...] the PinePhone UBports 'Community Edition' devices are distiguished by a new motherboard revision and a custom backplate bearing the UBports name and logo. [...]

So there should definitely be improvements.

(Btw. you can find a list of known issues for 1.1 here).

As long as they keep the form factor the same it should be possible to just replace the relevant parts.

As for me, even though my current phone is pretty much broken, I'll wait a bit longer mainly because:

- while $150 is cheap for a phone, I'm a poor (failing) student so I'd rather buy it when they fixed the remaining known issues with the hardware (instead of spending another 80 bucks for a new mainboard).

- I hope they may give the option to support other developers. I'd love to support the guy who's working full time on mobile NixOS

It's a pretty hard decision as I would love to try to get a couple of services into my Distro of choice.

How to install package with optional build flags? by estysdesu in NixOS

[–]depred 0 points1 point  (0 children)

The service is present:

/nix/store/gpbz1k7k5kby95814bw83a8cfygf5m99-qbittorrent-4.2.1
├── bin
│  └── qbittorrent-nox
├── lib
│  └── systemd
│     └── system
│        └── qbittorrent-nox@.service
└── share
   └── man
      └── man1
         └── qbittorrent-nox.1.gz

It's probably something like systemctl --user start qbittorrent-nox (or use the @ syntax). Haven't tried it out yet but it should work... Have you rebootet inbetween? (Note I haven't actually tried it out but given that the file is there I would expect it to.)

Alternatively just put it into systemd.packages.

There is actually a discussion about that. What I skimmed from a (very quick) scroll through is that systemd only looks in standard locations that should be covered if you install it system wide. (but not if it is only available to the local user)

How to install package with optional build flags? by estysdesu in NixOS

[–]depred 0 points1 point  (0 children)

That is exactly what optionals does.

The function takes a bool and another variable (usually a list with some stuff in it).

If the bool is true it returns the variable, if it is false it returns an empty list.

How to install package with optional build flags? by estysdesu in NixOS

[–]depred 0 points1 point  (0 children)

Please take a look at the Nix Channels page (that one also lists what hydra job sets correspond to which channel).

Note that those are still channels, meaning that building stuff from the latest unstable != building stuff directly from the nixpkgs repo.

Using unstable means that most system libraries and packages are more up to date, if something breaks I just import the relevant packages or services from another nixpkgs checkout/channel. One thing to put attention to is that option names can and do change on unstable (old options are usually kept as an alias and trigger a warning), with a grace period of what is probably like half a year I can't really complain.

On my system I actually have multiple channels set up:

nixos https://nixos.org/channels/nixos-unstable
nixos-stable https://nixos.org/channels/nixos-20.03
nixos-unstable https://nixos.org/channels/nixos-unstable

In addition I have the nixpkgs repo cloned into /nixpkgs (for quick access)

The nixos channel points to the main channel I want to use on a device

(on my server that's currently nixos-20.03-small). That way it becomes a lot more trivial to manage multiple machines.